diff options
Diffstat (limited to 'sound/core/sound.c')
-rw-r--r-- | sound/core/sound.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index 838dd9ee957c..c0685e2f0afa 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -206,20 +206,23 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) | |||
206 | minor = type; | 206 | minor = type; |
207 | break; | 207 | break; |
208 | case SNDRV_DEVICE_TYPE_CONTROL: | 208 | case SNDRV_DEVICE_TYPE_CONTROL: |
209 | snd_assert(card != NULL, return -EINVAL); | 209 | if (snd_BUG_ON(!card)) |
210 | return -EINVAL; | ||
210 | minor = SNDRV_MINOR(card->number, type); | 211 | minor = SNDRV_MINOR(card->number, type); |
211 | break; | 212 | break; |
212 | case SNDRV_DEVICE_TYPE_HWDEP: | 213 | case SNDRV_DEVICE_TYPE_HWDEP: |
213 | case SNDRV_DEVICE_TYPE_RAWMIDI: | 214 | case SNDRV_DEVICE_TYPE_RAWMIDI: |
214 | case SNDRV_DEVICE_TYPE_PCM_PLAYBACK: | 215 | case SNDRV_DEVICE_TYPE_PCM_PLAYBACK: |
215 | case SNDRV_DEVICE_TYPE_PCM_CAPTURE: | 216 | case SNDRV_DEVICE_TYPE_PCM_CAPTURE: |
216 | snd_assert(card != NULL, return -EINVAL); | 217 | if (snd_BUG_ON(!card)) |
218 | return -EINVAL; | ||
217 | minor = SNDRV_MINOR(card->number, type + dev); | 219 | minor = SNDRV_MINOR(card->number, type + dev); |
218 | break; | 220 | break; |
219 | default: | 221 | default: |
220 | return -EINVAL; | 222 | return -EINVAL; |
221 | } | 223 | } |
222 | snd_assert(minor >= 0 && minor < SNDRV_OS_MINORS, return -EINVAL); | 224 | if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OS_MINORS)) |
225 | return -EINVAL; | ||
223 | return minor; | 226 | return minor; |
224 | } | 227 | } |
225 | #endif | 228 | #endif |
@@ -247,7 +250,8 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | |||
247 | int minor; | 250 | int minor; |
248 | struct snd_minor *preg; | 251 | struct snd_minor *preg; |
249 | 252 | ||
250 | snd_assert(name, return -EINVAL); | 253 | if (snd_BUG_ON(!name)) |
254 | return -EINVAL; | ||
251 | preg = kmalloc(sizeof *preg, GFP_KERNEL); | 255 | preg = kmalloc(sizeof *preg, GFP_KERNEL); |
252 | if (preg == NULL) | 256 | if (preg == NULL) |
253 | return -ENOMEM; | 257 | return -ENOMEM; |