Commit 49cdd5b6 authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

ALSA: snd-usb-caiaq: fix stream count check

Commit 897c329b ("ALSA: usb: caiaq: check for cdev->n_streams > 1")
introduced a safety check to protect against bogus data provided by
devices. However, the n_streams variable is already divided by
CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.

Fix this to un-break support for stereo devices.
Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
Cc: stable@kernel.org [v3.18+]
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 62f64a88
...@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev) ...@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
return -EINVAL; return -EINVAL;
} }
if (cdev->n_streams < 2) { if (cdev->n_streams < 1) {
dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams); dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment