Skip to content

Commit 622207d

Browse files
tiwaiperexg
authored andcommitted
ALSA: Kill snd_assert() in sound/isa/*
Kill snd_assert() in sound/isa/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
1 parent 7eaa943 commit 622207d

18 files changed

Lines changed: 80 additions & 42 deletions

‎sound/isa/ad1816a/ad1816a_lib.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ static int snd_ad1816a_timer_open(struct snd_timer *timer)
394394

395395
static unsigned long snd_ad1816a_timer_resolution(struct snd_timer *timer)
396396
{
397-
snd_assert(timer != NULL, return 0);
397+
if (snd_BUG_ON(!timer))
398+
return 0;
398399

399400
return 10000;
400401
}
@@ -961,7 +962,8 @@ int __devinit snd_ad1816a_mixer(struct snd_ad1816a *chip)
961962
unsigned int idx;
962963
int err;
963964

964-
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
965+
if (snd_BUG_ON(!chip || !chip->card))
966+
return -EINVAL;
965967

966968
card = chip->card;
967969

‎sound/isa/cs423x/cs4236_lib.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ int snd_cs4236_mixer(struct snd_wss *chip)
967967
int err;
968968
struct snd_kcontrol_new *kcontrol;
969969

970-
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
970+
if (snd_BUG_ON(!chip || !chip->card))
971+
return -EINVAL;
971972
card = chip->card;
972973
strcpy(card->mixername, snd_wss_chip_id(chip));
973974

‎sound/isa/es1688/es1688_lib.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,8 @@ int snd_es1688_mixer(struct snd_es1688 *chip)
10091009
int err;
10101010
unsigned char reg, val;
10111011

1012-
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
1012+
if (snd_BUG_ON(!chip || !chip->card))
1013+
return -EINVAL;
10131014

10141015
card = chip->card;
10151016

‎sound/isa/gus/gus_main.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,11 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches)
276276
static unsigned char dmas[8] =
277277
{6, 1, 0, 2, 0, 3, 4, 5};
278278

279-
snd_assert(gus != NULL, return -EINVAL);
279+
if (snd_BUG_ON(!gus))
280+
return -EINVAL;
280281
card = gus->card;
281-
snd_assert(card != NULL, return -EINVAL);
282+
if (snd_BUG_ON(!card))
283+
return -EINVAL;
282284

283285
gus->mix_cntrl_reg &= 0xf8;
284286
gus->mix_cntrl_reg |= 0x01; /* disable MIC, LINE IN, enable LINE OUT */

‎sound/isa/gus/gus_mixer.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus)
161161
unsigned int idx, max;
162162
int err;
163163

164-
snd_assert(gus != NULL, return -EINVAL);
164+
if (snd_BUG_ON(!gus))
165+
return -EINVAL;
165166
card = gus->card;
166-
snd_assert(card != NULL, return -EINVAL);
167+
if (snd_BUG_ON(!card))
168+
return -EINVAL;
167169

168170
if (gus->ics_flag)
169171
snd_component_add(card, "ICS2101");

‎sound/isa/gus/gus_pcm.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,10 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
352352

353353
bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
354354
len = samples_to_bytes(runtime, count);
355-
snd_assert(bpos <= pcmp->dma_size, return -EIO);
356-
snd_assert(bpos + len <= pcmp->dma_size, return -EIO);
355+
if (snd_BUG_ON(bpos > pcmp->dma_size))
356+
return -EIO;
357+
if (snd_BUG_ON(bpos + len > pcmp->dma_size))
358+
return -EIO;
357359
if (copy_from_user(runtime->dma_area + bpos, src, len))
358360
return -EFAULT;
359361
if (snd_gf1_pcm_use_dma && len > 32) {
@@ -381,8 +383,10 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
381383

382384
bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
383385
len = samples_to_bytes(runtime, count);
384-
snd_assert(bpos <= pcmp->dma_size, return -EIO);
385-
snd_assert(bpos + len <= pcmp->dma_size, return -EIO);
386+
if (snd_BUG_ON(bpos > pcmp->dma_size))
387+
return -EIO;
388+
if (snd_BUG_ON(bpos + len > pcmp->dma_size))
389+
return -EIO;
386390
snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
387391
if (snd_gf1_pcm_use_dma && len > 32) {
388392
return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);

‎sound/isa/opti9xx/miro.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ static int __devinit snd_miro_mixer(struct snd_miro *miro)
675675
unsigned int idx;
676676
int err;
677677

678-
snd_assert(miro != NULL && miro->card != NULL, return -EINVAL);
678+
if (snd_BUG_ON(!miro || !miro->card))
679+
return -EINVAL;
679680

680681
card = miro->card;
681682

‎sound/isa/sb/emu8000.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,8 @@ snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu)
10231023
{
10241024
int i, err = 0;
10251025

1026-
snd_assert(emu != NULL && card != NULL, return -EINVAL);
1026+
if (snd_BUG_ON(!emu || !card))
1027+
return -EINVAL;
10271028

10281029
spin_lock_init(&emu->control_lock);
10291030

‎sound/isa/sb/emu8000_patch.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
156156
struct snd_emu8000 *emu;
157157

158158
emu = rec->hw;
159-
snd_assert(sp != NULL, return -EINVAL);
159+
if (snd_BUG_ON(!sp))
160+
return -EINVAL;
160161

161162
if (sp->v.size == 0)
162163
return 0;

‎sound/isa/sb/sb16_csp.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ static int snd_sb_csp_ioctl(struct snd_hwdep * hw, struct file *file, unsigned i
198198
struct snd_sb_csp_start start_info;
199199
int err;
200200

201-
snd_assert(p != NULL, return -EINVAL);
201+
if (snd_BUG_ON(!p))
202+
return -EINVAL;
202203

203204
if (snd_sb_csp_check_version(p))
204205
return -ENODEV;
@@ -1046,7 +1047,8 @@ static int snd_sb_qsound_build(struct snd_sb_csp * p)
10461047
struct snd_card *card;
10471048
int err;
10481049

1049-
snd_assert(p != NULL, return -EINVAL);
1050+
if (snd_BUG_ON(!p))
1051+
return -EINVAL;
10501052

10511053
card = p->chip->card;
10521054
p->qpos_left = p->qpos_right = SNDRV_SB_CSP_QSOUND_MAX_RIGHT / 2;
@@ -1071,7 +1073,8 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p)
10711073
struct snd_card *card;
10721074
unsigned long flags;
10731075

1074-
snd_assert(p != NULL, return);
1076+
if (snd_BUG_ON(!p))
1077+
return;
10751078

10761079
card = p->chip->card;
10771080

0 commit comments

Comments
 (0)