mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:31:02 +07:00
ALSA: usb: caiaq: check for cdev->n_streams > 1
Coverity spotted a possible DIV0 condition when cdev->n_streams is 0. Fix this by making sure the value is > 1 in snd_usb_caiaq_audio_init(). Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9d36a7dc4d
commit
897c329bcb
@ -816,6 +816,11 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cdev->n_streams < 2) {
|
||||
dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = snd_pcm_new(cdev->chip.card, cdev->product_name, 0,
|
||||
cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user