From: Johan Hovold Date: Wed, 1 Jul 2015 10:37:31 +0000 (+0200) Subject: greybus: operation: fix cancellation of responses X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1416 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=188f9785cfc5b1dc306ef1ca36e4c8dd203ccf56;p=karo-tx-linux.git 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 --- 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);