All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison
@ 2025-08-19  7:51 Šerif Rami
  2025-08-19  9:31 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Šerif Rami @ 2025-08-19  7:51 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Šerif Rami, Stephen Rothwell,
	linux-sound, linux-kernel
  Cc: kernel test robot

The `us144mkii.c` driver was generating sparse warnings due to direct
comparisons of `dev->descriptor.idProduct` (a `__le16` type) with
integer constants. This commit resolves these warnings by explicitly
converting `idProduct` to a CPU-endian integer using `le16_to_cpu()`
before comparison.

This ensures correct handling of endianness and eliminates the sparse
warnings:
- `restricted __le16 degrades to integer`

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508190811.tjQJZI1X-lkp@intel.com/
Signed-off-by: Šerif Rami <ramiserifpersia@gmail.com>
---
 sound/usb/usx2y/us144mkii.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/usb/usx2y/us144mkii.c b/sound/usb/usx2y/us144mkii.c
index da53c1908..3127a3206 100644
--- a/sound/usb/usx2y/us144mkii.c
+++ b/sound/usb/usx2y/us144mkii.c
@@ -514,10 +514,10 @@ static int tascam_probe(struct usb_interface *intf,
 	}
 
 	strscpy(card->driver, DRIVER_NAME, sizeof(card->driver));
-	if (dev->descriptor.idProduct == USB_PID_TASCAM_US144) {
+	if (le16_to_cpu(dev->descriptor.idProduct) == USB_PID_TASCAM_US144) {
 		strscpy(card->shortname, "TASCAM US-144",
 			sizeof(card->shortname));
-	} else if (dev->descriptor.idProduct == USB_PID_TASCAM_US144MKII) {
+	} else if (le16_to_cpu(dev->descriptor.idProduct) == USB_PID_TASCAM_US144MKII) {
 		strscpy(card->shortname, "TASCAM US-144MKII",
 			sizeof(card->shortname));
 	} else {
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison
  2025-08-19  7:51 [PATCH] ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison Šerif Rami
@ 2025-08-19  9:31 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-08-19  9:31 UTC (permalink / raw)
  To: Šerif Rami
  Cc: Jaroslav Kysela, Takashi Iwai, Stephen Rothwell, linux-sound,
	linux-kernel, kernel test robot

On Tue, 19 Aug 2025 09:51:17 +0200,
Šerif Rami wrote:
> 
> The `us144mkii.c` driver was generating sparse warnings due to direct
> comparisons of `dev->descriptor.idProduct` (a `__le16` type) with
> integer constants. This commit resolves these warnings by explicitly
> converting `idProduct` to a CPU-endian integer using `le16_to_cpu()`
> before comparison.
> 
> This ensures correct handling of endianness and eliminates the sparse
> warnings:
> - `restricted __le16 degrades to integer`
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508190811.tjQJZI1X-lkp@intel.com/
> Signed-off-by: Šerif Rami <ramiserifpersia@gmail.com>

Thanks, I applied now with Fixes tag.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-19  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  7:51 [PATCH] ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison Šerif Rami
2025-08-19  9:31 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.