aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:14 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:38 -0400
commitda3cec35dd3c31d8706db4bf379372ce70d92118 (patch)
tree9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/hda
parent622207dc31895b4e82c39100db8635d885c795e2 (diff)
ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, 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>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_codec.c21
-rw-r--r--sound/pci/hda/hda_generic.c3
-rw-r--r--sound/pci/hda/hda_intel.c3
-rw-r--r--sound/pci/hda/patch_realtek.c6
4 files changed, 22 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d2e1093f8e97..77fbcd4a69b7 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -211,7 +211,8 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
211 unsigned int shift, num_elems, mask; 211 unsigned int shift, num_elems, mask;
212 hda_nid_t prev_nid; 212 hda_nid_t prev_nid;
213 213
214 snd_assert(conn_list && max_conns > 0, return -EINVAL); 214 if (snd_BUG_ON(!conn_list || max_conns <= 0))
215 return -EINVAL;
215 216
216 parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN); 217 parm = snd_hda_param_read(codec, nid, AC_PAR_CONNLIST_LEN);
217 if (parm & AC_CLIST_LONG) { 218 if (parm & AC_CLIST_LONG) {
@@ -407,8 +408,10 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
407 .dev_free = snd_hda_bus_dev_free, 408 .dev_free = snd_hda_bus_dev_free,
408 }; 409 };
409 410
410 snd_assert(temp, return -EINVAL); 411 if (snd_BUG_ON(!temp))
411 snd_assert(temp->ops.command && temp->ops.get_response, return -EINVAL); 412 return -EINVAL;
413 if (snd_BUG_ON(!temp->ops.command || !temp->ops.get_response))
414 return -EINVAL;
412 415
413 if (busp) 416 if (busp)
414 *busp = NULL; 417 *busp = NULL;
@@ -588,8 +591,10 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
588 char component[13]; 591 char component[13];
589 int err; 592 int err;
590 593
591 snd_assert(bus, return -EINVAL); 594 if (snd_BUG_ON(!bus))
592 snd_assert(codec_addr <= HDA_MAX_CODEC_ADDRESS, return -EINVAL); 595 return -EINVAL;
596 if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS))
597 return -EINVAL;
593 598
594 if (bus->caddr_tbl[codec_addr]) { 599 if (bus->caddr_tbl[codec_addr]) {
595 snd_printk(KERN_ERR "hda_codec: " 600 snd_printk(KERN_ERR "hda_codec: "
@@ -2236,11 +2241,13 @@ static int __devinit set_pcm_default_values(struct hda_codec *codec,
2236 if (info->ops.close == NULL) 2241 if (info->ops.close == NULL)
2237 info->ops.close = hda_pcm_default_open_close; 2242 info->ops.close = hda_pcm_default_open_close;
2238 if (info->ops.prepare == NULL) { 2243 if (info->ops.prepare == NULL) {
2239 snd_assert(info->nid, return -EINVAL); 2244 if (snd_BUG_ON(!info->nid))
2245 return -EINVAL;
2240 info->ops.prepare = hda_pcm_default_prepare; 2246 info->ops.prepare = hda_pcm_default_prepare;
2241 } 2247 }
2242 if (info->ops.cleanup == NULL) { 2248 if (info->ops.cleanup == NULL) {
2243 snd_assert(info->nid, return -EINVAL); 2249 if (snd_BUG_ON(!info->nid))
2250 return -EINVAL;
2244 info->ops.cleanup = hda_pcm_default_cleanup; 2251 info->ops.cleanup = hda_pcm_default_cleanup;
2245 } 2252 }
2246 return 0; 2253 return 0;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 59e4389c94a4..0ca30894f7c6 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -174,7 +174,8 @@ static int build_afg_tree(struct hda_codec *codec)
174 int i, nodes, err; 174 int i, nodes, err;
175 hda_nid_t nid; 175 hda_nid_t nid;
176 176
177 snd_assert(spec, return -EINVAL); 177 if (snd_BUG_ON(!spec))
178 return -EINVAL;
178 179
179 spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP); 180 spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP);
180 spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP); 181 spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1c53e337ecb2..b2bcd94cf7a2 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1646,7 +1646,8 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec,
1646 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) 1646 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams)
1647 return 0; 1647 return 0;
1648 1648
1649 snd_assert(cpcm->name, return -EINVAL); 1649 if (snd_BUG_ON(!cpcm->name))
1650 return -EINVAL;
1650 1651
1651 err = snd_pcm_new(chip->card, cpcm->name, cpcm->device, 1652 err = snd_pcm_new(chip->card, cpcm->name, cpcm->device,
1652 cpcm->stream[0].substreams, 1653 cpcm->stream[0].substreams,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4bd26725355c..7e5422f64caf 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2633,12 +2633,14 @@ static int alc_build_pcms(struct hda_codec *codec)
2633 2633
2634 info->name = spec->stream_name_analog; 2634 info->name = spec->stream_name_analog;
2635 if (spec->stream_analog_playback) { 2635 if (spec->stream_analog_playback) {
2636 snd_assert(spec->multiout.dac_nids, return -EINVAL); 2636 if (snd_BUG_ON(!spec->multiout.dac_nids))
2637 return -EINVAL;
2637 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 2638 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2638 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2639 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2639 } 2640 }
2640 if (spec->stream_analog_capture) { 2641 if (spec->stream_analog_capture) {
2641 snd_assert(spec->adc_nids, return -EINVAL); 2642 if (snd_BUG_ON(!spec->adc_nids))
2643 return -EINVAL;
2642 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 2644 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2643 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2645 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2644 } 2646 }