From 188f9785cfc5b1dc306ef1ca36e4c8dd203ccf56 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Wed, 1 Jul 2015 12:37:31 +0200 Subject: [PATCH] greybus: operation: fix cancellation of responses An operation with a response in-flight will already have set the operation result and would therefore never be cancelled by the current implementation. Note that the reference taken when sending the result will be dropped in the message completion callback. Also note that an incoming, non-unidirectional messages will always have an allocated response if its result has been set. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 881dddc51abd..9e2ff7dd278a 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -845,9 +845,10 @@ void gb_operation_cancel(struct gb_operation *operation, int errno) { if (gb_operation_result_set(operation, errno)) { gb_message_cancel(operation->request); - if (operation->response) - gb_message_cancel(operation->response); gb_operation_put(operation); + } else if (gb_operation_is_incoming(operation)) { + if (!gb_operation_is_unidirectional(operation)) + gb_message_cancel(operation->response); } } EXPORT_SYMBOL_GPL(gb_operation_cancel); -- 2.39.5