From: Alex Elder Date: Tue, 21 Oct 2014 04:01:02 +0000 (-0500) Subject: greybus: fix op_cycle logic X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1985 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=03130a77d52bd738cdcee17627aa5e3d19fdbeeb;p=karo-tx-linux.git greybus: fix op_cycle logic The function that computes the operation id for a connection is wrongly using MOD rather than AND. Fix that. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 7a86c7cf3264..09fe25d5fee4 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -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, ...)