From: Stepan Ionichev <sozdayvek@gmail.com>
To: lee@kernel.org
Cc: pavel@kernel.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org, sozdayvek@gmail.com
Subject: [PATCH] leds: dac124s085: declare SPI command word as __le16
Date: Sun, 10 May 2026 05:36:32 +0500 [thread overview]
Message-ID: <20260510003632.35942-1-sozdayvek@gmail.com> (raw)
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>
---
drivers/leds/leds-dac124s085.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index cf5fb1195..192b43333 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -35,7 +35,7 @@ static int dac124s085_set_brightness(struct led_classdev *ldev,
{
struct dac124s085_led *led = container_of(ldev, struct dac124s085_led,
ldev);
- u16 word;
+ __le16 word;
int ret;
mutex_lock(&led->mutex);
--
2.43.0
reply other threads:[~2026-05-10 7:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260510003632.35942-1-sozdayvek@gmail.com \
--to=sozdayvek@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox