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>
This commit is contained in:
Johan Hovold 2015-07-01 12:37:31 +02:00 committed by Greg Kroah-Hartman
parent fde7382b47
commit 188f9785cf
1 changed files with 3 additions and 2 deletions

View File

@ -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);