Skip to content

Commit

Permalink
i2c: cp2615: Fix 'assignment to __be16' warning
Browse files Browse the repository at this point in the history
While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
which is the same in either endianness. However, to avoid generating a warning,
we should still call `htons()` explicitly.

Signed-off-by: Bence Csókás <bence98@sch.bme.hu>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
Bence Csókás authored and Wolfram Sang committed Nov 8, 2023
1 parent cc9c542 commit bdba49c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-cp2615.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int cp2615_init_iop_msg(struct cp2615_iop_msg *ret, enum cp2615_iop_msg_t
if (!ret)
return -EINVAL;

ret->preamble = 0x2A2A;
ret->preamble = htons(0x2A2AU);
ret->length = htons(data_len + 6);
ret->msg = htons(msg);
if (data && data_len)
Expand Down

0 comments on commit bdba49c

Please sign in to comment.