]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
greybus: fix op_cycle logic
authorAlex Elder <elder@linaro.org>
Tue, 21 Oct 2014 04:01:02 +0000 (23:01 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 21 Oct 2014 06:36:11 +0000 (14:36 +0800)
The function that computes the operation id for a connection is
wrongly using MOD rather than AND.  Fix that.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/connection.c

index 7a86c7cf3264e26673e3737ba15f8860d73493e1..09fe25d5fee427ba026b15a9e35eb7095d448c34 100644 (file)
@@ -171,7 +171,7 @@ void gb_connection_destroy(struct gb_connection *connection)
 
 u16 gb_connection_operation_id(struct gb_connection *connection)
 {
-       return (u16)(atomic_inc_return(&connection->op_cycle) U16_MAX);
+       return (u16)(atomic_inc_return(&connection->op_cycle) & (int)U16_MAX);
 }
 
 void gb_connection_err(struct gb_connection *connection, const char *fmt, ...)