mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Šerif Rami" <ramiserifpersia@gmail.com>
To: "Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Šerif Rami" <ramiserifpersia@gmail.com>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kernel test robot <lkp@intel.com>
Subject: [PATCH] ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison
Date: Tue, 19 Aug 2025 09:51:17 +0200	[thread overview]
Message-ID: <20250819075118.9221-1-ramiserifpersia@gmail.com> (raw)

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


             reply	other threads:[~2025-08-19  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19  7:51 Šerif Rami [this message]
2025-08-19  9:31 ` Takashi Iwai

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=20250819075118.9221-1-ramiserifpersia@gmail.com \
    --to=ramiserifpersia@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=perex@perex.cz \
    --cc=sfr@canb.auug.org.au \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®