diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-08-08 11:09:09 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-13 05:46:35 -0400 |
commit | 7eaa943c8ed8e91e05d0f5d0dc7a18e3319b45cf (patch) | |
tree | 51d86a4cb01cf5735b18c36ca62471f8c759a041 /sound/core/device.c | |
parent | 5ef03460a6ffc1d3ee6b6f2abc6765d3e224cf89 (diff) |
ALSA: Kill snd_assert() in sound/core/*
Kill snd_assert() in sound/core/*, 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/core/device.c')
-rw-r--r-- | sound/core/device.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/core/device.c b/sound/core/device.c index 202dac0e4d89..c58d8227254c 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -45,9 +45,8 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type, | |||
45 | { | 45 | { |
46 | struct snd_device *dev; | 46 | struct snd_device *dev; |
47 | 47 | ||
48 | snd_assert(card != NULL, return -ENXIO); | 48 | if (snd_BUG_ON(!card || !device_data || !ops)) |
49 | snd_assert(device_data != NULL, return -ENXIO); | 49 | return -ENXIO; |
50 | snd_assert(ops != NULL, return -ENXIO); | ||
51 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 50 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
52 | if (dev == NULL) { | 51 | if (dev == NULL) { |
53 | snd_printk(KERN_ERR "Cannot allocate device\n"); | 52 | snd_printk(KERN_ERR "Cannot allocate device\n"); |
@@ -80,8 +79,8 @@ int snd_device_free(struct snd_card *card, void *device_data) | |||
80 | { | 79 | { |
81 | struct snd_device *dev; | 80 | struct snd_device *dev; |
82 | 81 | ||
83 | snd_assert(card != NULL, return -ENXIO); | 82 | if (snd_BUG_ON(!card || !device_data)) |
84 | snd_assert(device_data != NULL, return -ENXIO); | 83 | return -ENXIO; |
85 | list_for_each_entry(dev, &card->devices, list) { | 84 | list_for_each_entry(dev, &card->devices, list) { |
86 | if (dev->device_data != device_data) | 85 | if (dev->device_data != device_data) |
87 | continue; | 86 | continue; |
@@ -123,8 +122,8 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) | |||
123 | { | 122 | { |
124 | struct snd_device *dev; | 123 | struct snd_device *dev; |
125 | 124 | ||
126 | snd_assert(card != NULL, return -ENXIO); | 125 | if (snd_BUG_ON(!card || !device_data)) |
127 | snd_assert(device_data != NULL, return -ENXIO); | 126 | return -ENXIO; |
128 | list_for_each_entry(dev, &card->devices, list) { | 127 | list_for_each_entry(dev, &card->devices, list) { |
129 | if (dev->device_data != device_data) | 128 | if (dev->device_data != device_data) |
130 | continue; | 129 | continue; |
@@ -159,8 +158,8 @@ int snd_device_register(struct snd_card *card, void *device_data) | |||
159 | struct snd_device *dev; | 158 | struct snd_device *dev; |
160 | int err; | 159 | int err; |
161 | 160 | ||
162 | snd_assert(card != NULL, return -ENXIO); | 161 | if (snd_BUG_ON(!card || !device_data)) |
163 | snd_assert(device_data != NULL, return -ENXIO); | 162 | return -ENXIO; |
164 | list_for_each_entry(dev, &card->devices, list) { | 163 | list_for_each_entry(dev, &card->devices, list) { |
165 | if (dev->device_data != device_data) | 164 | if (dev->device_data != device_data) |
166 | continue; | 165 | continue; |
@@ -188,7 +187,8 @@ int snd_device_register_all(struct snd_card *card) | |||
188 | struct snd_device *dev; | 187 | struct snd_device *dev; |
189 | int err; | 188 | int err; |
190 | 189 | ||
191 | snd_assert(card != NULL, return -ENXIO); | 190 | if (snd_BUG_ON(!card)) |
191 | return -ENXIO; | ||
192 | list_for_each_entry(dev, &card->devices, list) { | 192 | list_for_each_entry(dev, &card->devices, list) { |
193 | if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { | 193 | if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { |
194 | if ((err = dev->ops->dev_register(dev)) < 0) | 194 | if ((err = dev->ops->dev_register(dev)) < 0) |
@@ -208,7 +208,8 @@ int snd_device_disconnect_all(struct snd_card *card) | |||
208 | struct snd_device *dev; | 208 | struct snd_device *dev; |
209 | int err = 0; | 209 | int err = 0; |
210 | 210 | ||
211 | snd_assert(card != NULL, return -ENXIO); | 211 | if (snd_BUG_ON(!card)) |
212 | return -ENXIO; | ||
212 | list_for_each_entry(dev, &card->devices, list) { | 213 | list_for_each_entry(dev, &card->devices, list) { |
213 | if (snd_device_disconnect(card, dev->device_data) < 0) | 214 | if (snd_device_disconnect(card, dev->device_data) < 0) |
214 | err = -ENXIO; | 215 | err = -ENXIO; |
@@ -226,7 +227,8 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) | |||
226 | int err; | 227 | int err; |
227 | unsigned int range_low, range_high; | 228 | unsigned int range_low, range_high; |
228 | 229 | ||
229 | snd_assert(card != NULL, return -ENXIO); | 230 | if (snd_BUG_ON(!card)) |
231 | return -ENXIO; | ||
230 | range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; | 232 | range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; |
231 | range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; | 233 | range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; |
232 | __again: | 234 | __again: |