Loading include/sound/pcm.h +2 −0 Original line number Diff line number Diff line Loading @@ -1015,4 +1015,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) (IEC958_AES1_CON_PCM_CODER<<8)|\ (IEC958_AES3_CON_FS_48000<<24)) #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) #endif /* __SOUND_PCM_H */ sound/core/control.c +31 −19 Original line number Diff line number Diff line Loading @@ -139,7 +139,8 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, struct snd_ctl_file *ctl; struct snd_kctl_event *ev; snd_assert(card != NULL && id != NULL, return); if (snd_BUG_ON(!card || !id)) return; read_lock(&card->ctl_files_rwlock); #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) card->mixer_oss_change_count++; Loading Loading @@ -188,8 +189,8 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, struct snd_kcontrol *kctl; unsigned int idx; snd_assert(control != NULL, return NULL); snd_assert(control->count > 0, return NULL); if (snd_BUG_ON(!control || !control->count)) return NULL; kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); if (kctl == NULL) { snd_printk(KERN_ERR "Cannot allocate control instance\n"); Loading Loading @@ -218,8 +219,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, struct snd_kcontrol kctl; unsigned int access; snd_assert(ncontrol != NULL, return NULL); snd_assert(ncontrol->info != NULL, return NULL); if (snd_BUG_ON(!ncontrol || !ncontrol->info)) return NULL; memset(&kctl, 0, sizeof(kctl)); kctl.id.iface = ncontrol->iface; kctl.id.device = ncontrol->device; Loading Loading @@ -315,8 +316,8 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) if (! kcontrol) return err; snd_assert(card != NULL, goto error); snd_assert(kcontrol->info != NULL, goto error); if (snd_BUG_ON(!card || !kcontrol->info)) goto error; id = kcontrol->id; down_write(&card->controls_rwsem); if (snd_ctl_find_id(card, &id)) { Loading Loading @@ -367,7 +368,8 @@ int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol) struct snd_ctl_elem_id id; unsigned int idx; snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); if (snd_BUG_ON(!card || !kcontrol)) return -EINVAL; list_del(&kcontrol->list); card->controls_count -= kcontrol->count; id = kcontrol->id; Loading Loading @@ -487,7 +489,8 @@ struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numi { struct snd_kcontrol *kctl; snd_assert(card != NULL && numid != 0, return NULL); if (snd_BUG_ON(!card || !numid)) return NULL; list_for_each_entry(kctl, &card->controls, list) { if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) return kctl; Loading @@ -514,7 +517,8 @@ struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, { struct snd_kcontrol *kctl; snd_assert(card != NULL && id != NULL, return NULL); if (snd_BUG_ON(!card || !id)) return NULL; if (id->numid != 0) return snd_ctl_find_numid(card, id->numid); list_for_each_entry(kctl, &card->controls, list) { Loading Loading @@ -647,7 +651,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl, #endif result = kctl->info(kctl, info); if (result >= 0) { snd_assert(info->access == 0, ); snd_BUG_ON(info->access); index_offset = snd_ctl_get_ioff(kctl, &info->id); vd = &kctl->vd[index_offset]; snd_ctl_build_ioff(&info->id, kctl, index_offset); Loading Loading @@ -1160,7 +1164,8 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg ctl = file->private_data; card = ctl->card; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0; Loading Loading @@ -1222,7 +1227,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, ssize_t result = 0; ctl = file->private_data; snd_assert(ctl != NULL && ctl->card != NULL, return -ENXIO); if (snd_BUG_ON(!ctl || !ctl->card)) return -ENXIO; if (!ctl->subscribed) return -EBADFD; if (count < sizeof(struct snd_ctl_event)) Loading Loading @@ -1328,7 +1334,8 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, { struct snd_kctl_ioctl *p; snd_assert(fcn != NULL, return -EINVAL); if (snd_BUG_ON(!fcn)) return -EINVAL; down_write(&snd_ioctl_rwsem); list_for_each_entry(p, lists, list) { if (p->fioctl == fcn) { Loading Loading @@ -1404,9 +1411,11 @@ static int snd_ctl_dev_register(struct snd_device *device) int err, cardnum; char name[16]; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; cardnum = card->number; snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS)) return -ENXIO; sprintf(name, "controlC%i", cardnum); if ((err = snd_register_device(SNDRV_DEVICE_TYPE_CONTROL, card, -1, &snd_ctl_f_ops, card, name)) < 0) Loading @@ -1423,9 +1432,11 @@ static int snd_ctl_dev_disconnect(struct snd_device *device) struct snd_ctl_file *ctl; int err, cardnum; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; cardnum = card->number; snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS)) return -ENXIO; down_read(&card->controls_rwsem); list_for_each_entry(ctl, &card->ctl_files, list) { Loading Loading @@ -1469,7 +1480,8 @@ int snd_ctl_create(struct snd_card *card) .dev_disconnect = snd_ctl_dev_disconnect, }; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; return snd_device_new(card, SNDRV_DEV_CONTROL, card, &ops); } Loading sound/core/control_compat.c +2 −1 Original line number Diff line number Diff line Loading @@ -398,7 +398,8 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns int err; ctl = file->private_data; snd_assert(ctl && ctl->card, return -ENXIO); if (snd_BUG_ON(!ctl || !ctl->card)) return -ENXIO; switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: Loading sound/core/device.c +14 −12 Original line number Diff line number Diff line Loading @@ -45,9 +45,8 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type, { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); snd_assert(ops != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data || !ops)) return -ENXIO; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { snd_printk(KERN_ERR "Cannot allocate device\n"); Loading Loading @@ -80,8 +79,8 @@ int snd_device_free(struct snd_card *card, void *device_data) { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -123,8 +122,8 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -159,8 +158,8 @@ int snd_device_register(struct snd_card *card, void *device_data) struct snd_device *dev; int err; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -188,7 +187,8 @@ int snd_device_register_all(struct snd_card *card) struct snd_device *dev; int err; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { if ((err = dev->ops->dev_register(dev)) < 0) Loading @@ -208,7 +208,8 @@ int snd_device_disconnect_all(struct snd_card *card) struct snd_device *dev; int err = 0; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (snd_device_disconnect(card, dev->device_data) < 0) err = -ENXIO; Loading @@ -226,7 +227,8 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) int err; unsigned int range_low, range_high; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; __again: Loading sound/core/hwdep.c +10 −6 Original line number Diff line number Diff line Loading @@ -353,9 +353,10 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, .dev_disconnect = snd_hwdep_dev_disconnect, }; snd_assert(rhwdep != NULL, return -EINVAL); if (snd_BUG_ON(!card)) return -ENXIO; if (rhwdep) *rhwdep = NULL; snd_assert(card != NULL, return -ENXIO); hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); if (hwdep == NULL) { snd_printk(KERN_ERR "hwdep: cannot allocate\n"); Loading @@ -374,13 +375,15 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, } init_waitqueue_head(&hwdep->open_wait); mutex_init(&hwdep->open_mutex); if (rhwdep) *rhwdep = hwdep; return 0; } static int snd_hwdep_free(struct snd_hwdep *hwdep) { snd_assert(hwdep != NULL, return -ENXIO); if (!hwdep) return 0; if (hwdep->private_free) hwdep->private_free(hwdep); kfree(hwdep); Loading Loading @@ -440,7 +443,8 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) { struct snd_hwdep *hwdep = device->device_data; snd_assert(hwdep != NULL, return -ENXIO); if (snd_BUG_ON(!hwdep)) return -ENXIO; mutex_lock(®ister_mutex); if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) { mutex_unlock(®ister_mutex); Loading Loading
include/sound/pcm.h +2 −0 Original line number Diff line number Diff line Loading @@ -1015,4 +1015,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) (IEC958_AES1_CON_PCM_CODER<<8)|\ (IEC958_AES3_CON_FS_48000<<24)) #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) #endif /* __SOUND_PCM_H */
sound/core/control.c +31 −19 Original line number Diff line number Diff line Loading @@ -139,7 +139,8 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, struct snd_ctl_file *ctl; struct snd_kctl_event *ev; snd_assert(card != NULL && id != NULL, return); if (snd_BUG_ON(!card || !id)) return; read_lock(&card->ctl_files_rwlock); #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) card->mixer_oss_change_count++; Loading Loading @@ -188,8 +189,8 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, struct snd_kcontrol *kctl; unsigned int idx; snd_assert(control != NULL, return NULL); snd_assert(control->count > 0, return NULL); if (snd_BUG_ON(!control || !control->count)) return NULL; kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); if (kctl == NULL) { snd_printk(KERN_ERR "Cannot allocate control instance\n"); Loading Loading @@ -218,8 +219,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, struct snd_kcontrol kctl; unsigned int access; snd_assert(ncontrol != NULL, return NULL); snd_assert(ncontrol->info != NULL, return NULL); if (snd_BUG_ON(!ncontrol || !ncontrol->info)) return NULL; memset(&kctl, 0, sizeof(kctl)); kctl.id.iface = ncontrol->iface; kctl.id.device = ncontrol->device; Loading Loading @@ -315,8 +316,8 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) if (! kcontrol) return err; snd_assert(card != NULL, goto error); snd_assert(kcontrol->info != NULL, goto error); if (snd_BUG_ON(!card || !kcontrol->info)) goto error; id = kcontrol->id; down_write(&card->controls_rwsem); if (snd_ctl_find_id(card, &id)) { Loading Loading @@ -367,7 +368,8 @@ int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol) struct snd_ctl_elem_id id; unsigned int idx; snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); if (snd_BUG_ON(!card || !kcontrol)) return -EINVAL; list_del(&kcontrol->list); card->controls_count -= kcontrol->count; id = kcontrol->id; Loading Loading @@ -487,7 +489,8 @@ struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numi { struct snd_kcontrol *kctl; snd_assert(card != NULL && numid != 0, return NULL); if (snd_BUG_ON(!card || !numid)) return NULL; list_for_each_entry(kctl, &card->controls, list) { if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) return kctl; Loading @@ -514,7 +517,8 @@ struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, { struct snd_kcontrol *kctl; snd_assert(card != NULL && id != NULL, return NULL); if (snd_BUG_ON(!card || !id)) return NULL; if (id->numid != 0) return snd_ctl_find_numid(card, id->numid); list_for_each_entry(kctl, &card->controls, list) { Loading Loading @@ -647,7 +651,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl, #endif result = kctl->info(kctl, info); if (result >= 0) { snd_assert(info->access == 0, ); snd_BUG_ON(info->access); index_offset = snd_ctl_get_ioff(kctl, &info->id); vd = &kctl->vd[index_offset]; snd_ctl_build_ioff(&info->id, kctl, index_offset); Loading Loading @@ -1160,7 +1164,8 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg ctl = file->private_data; card = ctl->card; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0; Loading Loading @@ -1222,7 +1227,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, ssize_t result = 0; ctl = file->private_data; snd_assert(ctl != NULL && ctl->card != NULL, return -ENXIO); if (snd_BUG_ON(!ctl || !ctl->card)) return -ENXIO; if (!ctl->subscribed) return -EBADFD; if (count < sizeof(struct snd_ctl_event)) Loading Loading @@ -1328,7 +1334,8 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, { struct snd_kctl_ioctl *p; snd_assert(fcn != NULL, return -EINVAL); if (snd_BUG_ON(!fcn)) return -EINVAL; down_write(&snd_ioctl_rwsem); list_for_each_entry(p, lists, list) { if (p->fioctl == fcn) { Loading Loading @@ -1404,9 +1411,11 @@ static int snd_ctl_dev_register(struct snd_device *device) int err, cardnum; char name[16]; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; cardnum = card->number; snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS)) return -ENXIO; sprintf(name, "controlC%i", cardnum); if ((err = snd_register_device(SNDRV_DEVICE_TYPE_CONTROL, card, -1, &snd_ctl_f_ops, card, name)) < 0) Loading @@ -1423,9 +1432,11 @@ static int snd_ctl_dev_disconnect(struct snd_device *device) struct snd_ctl_file *ctl; int err, cardnum; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; cardnum = card->number; snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); if (snd_BUG_ON(cardnum < 0 || cardnum >= SNDRV_CARDS)) return -ENXIO; down_read(&card->controls_rwsem); list_for_each_entry(ctl, &card->ctl_files, list) { Loading Loading @@ -1469,7 +1480,8 @@ int snd_ctl_create(struct snd_card *card) .dev_disconnect = snd_ctl_dev_disconnect, }; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; return snd_device_new(card, SNDRV_DEV_CONTROL, card, &ops); } Loading
sound/core/control_compat.c +2 −1 Original line number Diff line number Diff line Loading @@ -398,7 +398,8 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns int err; ctl = file->private_data; snd_assert(ctl && ctl->card, return -ENXIO); if (snd_BUG_ON(!ctl || !ctl->card)) return -ENXIO; switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: Loading
sound/core/device.c +14 −12 Original line number Diff line number Diff line Loading @@ -45,9 +45,8 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type, { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); snd_assert(ops != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data || !ops)) return -ENXIO; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { snd_printk(KERN_ERR "Cannot allocate device\n"); Loading Loading @@ -80,8 +79,8 @@ int snd_device_free(struct snd_card *card, void *device_data) { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -123,8 +122,8 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) { struct snd_device *dev; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -159,8 +158,8 @@ int snd_device_register(struct snd_card *card, void *device_data) struct snd_device *dev; int err; snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); if (snd_BUG_ON(!card || !device_data)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->device_data != device_data) continue; Loading Loading @@ -188,7 +187,8 @@ int snd_device_register_all(struct snd_card *card) struct snd_device *dev; int err; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { if ((err = dev->ops->dev_register(dev)) < 0) Loading @@ -208,7 +208,8 @@ int snd_device_disconnect_all(struct snd_card *card) struct snd_device *dev; int err = 0; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { if (snd_device_disconnect(card, dev->device_data) < 0) err = -ENXIO; Loading @@ -226,7 +227,8 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) int err; unsigned int range_low, range_high; snd_assert(card != NULL, return -ENXIO); if (snd_BUG_ON(!card)) return -ENXIO; range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; __again: Loading
sound/core/hwdep.c +10 −6 Original line number Diff line number Diff line Loading @@ -353,9 +353,10 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, .dev_disconnect = snd_hwdep_dev_disconnect, }; snd_assert(rhwdep != NULL, return -EINVAL); if (snd_BUG_ON(!card)) return -ENXIO; if (rhwdep) *rhwdep = NULL; snd_assert(card != NULL, return -ENXIO); hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); if (hwdep == NULL) { snd_printk(KERN_ERR "hwdep: cannot allocate\n"); Loading @@ -374,13 +375,15 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, } init_waitqueue_head(&hwdep->open_wait); mutex_init(&hwdep->open_mutex); if (rhwdep) *rhwdep = hwdep; return 0; } static int snd_hwdep_free(struct snd_hwdep *hwdep) { snd_assert(hwdep != NULL, return -ENXIO); if (!hwdep) return 0; if (hwdep->private_free) hwdep->private_free(hwdep); kfree(hwdep); Loading Loading @@ -440,7 +443,8 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) { struct snd_hwdep *hwdep = device->device_data; snd_assert(hwdep != NULL, return -ENXIO); if (snd_BUG_ON(!hwdep)) return -ENXIO; mutex_lock(®ister_mutex); if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) { mutex_unlock(®ister_mutex); Loading