From: Alex Elder Date: Mon, 1 Dec 2014 13:53:11 +0000 (-0600) Subject: greybus: always drop reference in gb_operation_work() X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1804 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e5fbc07360f1ed9da423abc2ab96a12f2d7a7632;p=karo-tx-linux.git greybus: always drop reference in gb_operation_work() Currently we issue a warning in gb_operation_work() if an operation has no callback function defined. But we return without dropping the reference to the operation as we should. Stop warning if there's no callback, call it only if it's defined, and always drop the operation reference before returning. This means we're now treating a NULL callback pointer as a normal condition. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 75900d3129be..aaac03733fd4 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -265,11 +265,10 @@ static void gb_operation_work(struct work_struct *work) struct gb_operation *operation; operation = container_of(work, struct gb_operation, work); - if (WARN_ON(!operation->callback)) - return; - - operation->callback(operation); - operation->callback = NULL; + if (operation->callback) { + operation->callback(operation); + operation->callback = NULL; + } gb_operation_put(operation); }