aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2013-04-05 14:49:46 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-07 03:44:08 -0400
commit889d66848b12d891248b03abcb2a42047f8e172a (patch)
tree8a64d578be6020598ebd256f6b8c5406b900ab7d /sound/usb
parent868211db6df96ddae411fcd800502725beef8387 (diff)
ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_*
The usb_control_msg() function expects __u16 types and performs the endianness conversions by itself. However, in three places, a conversion is performed before it is handed over to usb_control_msg(), which leads to a double conversion (= no conversion): * snd_usb_nativeinstruments_boot_quirk() * snd_nativeinstruments_control_get() * snd_nativeinstruments_control_put() Caught by sparse: sound/usb/mixer_quirks.c:512:38: warning: incorrect type in argument 6 (different base types) sound/usb/mixer_quirks.c:512:38: expected unsigned short [unsigned] [usertype] index sound/usb/mixer_quirks.c:512:38: got restricted __le16 [usertype] <noident> sound/usb/mixer_quirks.c:543:35: warning: incorrect type in argument 5 (different base types) sound/usb/mixer_quirks.c:543:35: expected unsigned short [unsigned] [usertype] value sound/usb/mixer_quirks.c:543:35: got restricted __le16 [usertype] <noident> sound/usb/mixer_quirks.c:543:56: warning: incorrect type in argument 6 (different base types) sound/usb/mixer_quirks.c:543:56: expected unsigned short [unsigned] [usertype] index sound/usb/mixer_quirks.c:543:56: got restricted __le16 [usertype] <noident> sound/usb/quirks.c:502:35: warning: incorrect type in argument 5 (different base types) sound/usb/quirks.c:502:35: expected unsigned short [unsigned] [usertype] value sound/usb/quirks.c:502:35: got restricted __le16 [usertype] <noident> Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Acked-by: Daniel Mack <zonque@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_quirks.c4
-rw-r--r--sound/usb/quirks.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 497d2741d119..ebe91440a068 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -509,7 +509,7 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
509 else 509 else
510 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, 510 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
511 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 511 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
512 0, cpu_to_le16(wIndex), 512 0, wIndex,
513 &tmp, sizeof(tmp), 1000); 513 &tmp, sizeof(tmp), 1000);
514 up_read(&mixer->chip->shutdown_rwsem); 514 up_read(&mixer->chip->shutdown_rwsem);
515 515
@@ -540,7 +540,7 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
540 else 540 else
541 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, 541 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
542 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, 542 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
543 cpu_to_le16(wValue), cpu_to_le16(wIndex), 543 wValue, wIndex,
544 NULL, 0, 1000); 544 NULL, 0, 1000);
545 up_read(&mixer->chip->shutdown_rwsem); 545 up_read(&mixer->chip->shutdown_rwsem);
546 546
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 5325a3869bb7..9c5ab22358b1 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -486,7 +486,7 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev)
486{ 486{
487 int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 487 int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
488 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE, 488 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
489 cpu_to_le16(1), 0, NULL, 0, 1000); 489 1, 0, NULL, 0, 1000);
490 490
491 if (ret < 0) 491 if (ret < 0)
492 return ret; 492 return ret;