Commit e5fbc073 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e413614b
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -265,11 +265,10 @@ static void gb_operation_work(struct work_struct *work)
	struct gb_operation *operation;
	struct gb_operation *operation;


	operation = container_of(work, struct gb_operation, work);
	operation = container_of(work, struct gb_operation, work);
	if (WARN_ON(!operation->callback))
	if (operation->callback) {
		return;

		operation->callback(operation);
		operation->callback(operation);
		operation->callback = NULL;
		operation->callback = NULL;
	}
	gb_operation_put(operation);
	gb_operation_put(operation);
}
}