Commit 03130a77 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 1ec1d6dd
...@@ -171,7 +171,7 @@ void gb_connection_destroy(struct gb_connection *connection) ...@@ -171,7 +171,7 @@ void gb_connection_destroy(struct gb_connection *connection)
u16 gb_connection_operation_id(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, ...) void gb_connection_err(struct gb_connection *connection, const char *fmt, ...)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment