diff options
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index a70ee7f1ed98..031e215b6dde 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -272,7 +272,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, | |||
272 | if (get_user(device, (int __user *)arg)) | 272 | if (get_user(device, (int __user *)arg)) |
273 | return -EFAULT; | 273 | return -EFAULT; |
274 | mutex_lock(®ister_mutex); | 274 | mutex_lock(®ister_mutex); |
275 | device = device < 0 ? 0 : device + 1; | 275 | |
276 | if (device < 0) | ||
277 | device = 0; | ||
278 | else if (device < SNDRV_MINOR_HWDEPS) | ||
279 | device++; | ||
280 | else | ||
281 | device = SNDRV_MINOR_HWDEPS; | ||
282 | |||
276 | while (device < SNDRV_MINOR_HWDEPS) { | 283 | while (device < SNDRV_MINOR_HWDEPS) { |
277 | if (snd_hwdep_search(card, device)) | 284 | if (snd_hwdep_search(card, device)) |
278 | break; | 285 | break; |