Skip to content

Commit d0316c8

Browse files
root3315lag-linaro
authored andcommitted
leds: dac124s085: Declare SPI command word as __le16
dac124s085_set_brightness() builds a 16-bit SPI command word: u16 word; ... word = cpu_to_le16(((led->id) << 14) | REG_WRITE_UPDATE | (brightness & 0xfff)); ret = spi_write(led->spi, (const u8 *)&word, sizeof(word)); cpu_to_le16() returns __le16, but the local 'word' is declared as plain u16, which sparse flags: drivers/leds/leds-dac124s085.c:42:14: warning: incorrect type in assignment (different base types) The bytes that hit the wire are correct because cpu_to_le16() does the right thing on either endianness, but mixing the annotated and unannotated types defeats sparse's __bitwise checking and would let a future reader treat the buffer as a host-endian u16 by mistake. Declare 'word' as __le16 to match how it is built and consumed. No functional change. Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com> Link: https://patch.msgid.link/20260510003632.35942-1-sozdayvek@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 2682d63 commit d0316c8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/leds/leds-dac124s085.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int dac124s085_set_brightness(struct led_classdev *ldev,
3535
{
3636
struct dac124s085_led *led = container_of(ldev, struct dac124s085_led,
3737
ldev);
38-
u16 word;
38+
__le16 word;
3939
int ret;
4040

4141
mutex_lock(&led->mutex);

0 commit comments

Comments
 (0)