summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/operation.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-07-01 12:37:31 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-01 16:54:44 -0700
commit188f9785cfc5b1dc306ef1ca36e4c8dd203ccf56 (patch)
tree48625836ba9355f70408665962729dfd16b40eb0 /drivers/staging/greybus/operation.c
parentfde7382b47c5fbb64be81420d267f1e314cfee94 (diff)
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 <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r--drivers/staging/greybus/operation.c5
1 files 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);