From 0ba02c4d1675c426f38f3beb6b6cb1a3d9aeff97 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Wed, 3 Dec 2014 08:35:06 -0600 Subject: [PATCH] greybus: don't use 0 as an operation id Stop allowing 0x0000 to be used as an operation id. That id will be reserved for use by operations that will return no response message. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index b2ebbe42a45b..c0e206db9ed7 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -151,10 +151,11 @@ static void gb_pending_operation_insert(struct gb_operation *operation) /* * Assign the operation's id and move it into its - * connection's pending list. + * connection's pending list. Zero is a reserved operation + * id. */ spin_lock_irq(&gb_operations_lock); - operation->id = ++connection->op_cycle; + operation->id = ++connection->op_cycle % U16_MAX + 1; list_move_tail(&operation->links, &connection->pending); spin_unlock_irq(&gb_operations_lock); -- 2.39.5