Skip to contentSkip to conversation

i2c: cp2615: Fix 'assignment to __be16' warning

PATCH Applied Bence Csókás 2 participants 2 messages Oct 30, 2023 – Nov 8, 2023

Subsystems (2)
lore
Share & tools
lore

Bence Csókás

author maintainer
#0 lore raw

PATCH v2 1/1 i2c: cp2615: Fix 'assignment to __be16' warning

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.

---
 drivers/i2c/busses/i2c-cp2615.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-cp2615.c +1 -1
index 20f8f7c9a8cd..cf3747d87034 100644
@@ -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)
Signature · 1 line
2.42.0
Applied
#1 lore raw
Quoted 5 lines · Bence Csókás

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.

Applied to for-current, thanks!