ALSA: usb-audio: us144mkii: Use le16_to_cpu() for product ID comparison

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`

Fixes: dee1bcf28a ("ALSA: usb-audio: Add initial driver for TASCAM US-144MKII")
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>
Link: https://patch.msgid.link/20250819075118.9221-1-ramiserifpersia@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Šerif Rami 2025-08-19 09:51:17 +02:00 committed by Takashi Iwai
parent 0ec417aa85
commit d9f0633867

View File

@ -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 {