ALSA: core: Drop superfluous error/debug messages after malloc failures
The kernel memory allocators already report the errors when the requested allocation fails, thus we don't need to warn it again in each caller side. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
24db8bbaa3
commit
ec0e9937aa
|
@ -217,10 +217,8 @@ static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
|
||||||
size += sizeof(struct snd_kcontrol_volatile) * count;
|
size += sizeof(struct snd_kcontrol_volatile) * count;
|
||||||
|
|
||||||
*kctl = kzalloc(size, GFP_KERNEL);
|
*kctl = kzalloc(size, GFP_KERNEL);
|
||||||
if (*kctl == NULL) {
|
if (!*kctl)
|
||||||
pr_err("ALSA: Cannot allocate control instance\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
for (idx = 0; idx < count; idx++) {
|
for (idx = 0; idx < count; idx++) {
|
||||||
(*kctl)->vd[idx].access = access;
|
(*kctl)->vd[idx].access = access;
|
||||||
|
|
|
@ -50,10 +50,8 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type,
|
||||||
if (snd_BUG_ON(!card || !device_data || !ops))
|
if (snd_BUG_ON(!card || !device_data || !ops))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||||
if (dev == NULL) {
|
if (!dev)
|
||||||
dev_err(card->dev, "Cannot allocate device, type=%d\n", type);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
INIT_LIST_HEAD(&dev->list);
|
INIT_LIST_HEAD(&dev->list);
|
||||||
dev->card = card;
|
dev->card = card;
|
||||||
dev->type = type;
|
dev->type = type;
|
||||||
|
|
|
@ -378,10 +378,8 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
||||||
if (rhwdep)
|
if (rhwdep)
|
||||||
*rhwdep = NULL;
|
*rhwdep = NULL;
|
||||||
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
|
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
|
||||||
if (hwdep == NULL) {
|
if (!hwdep)
|
||||||
dev_err(card->dev, "hwdep: cannot allocate\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
init_waitqueue_head(&hwdep->open_wait);
|
init_waitqueue_head(&hwdep->open_wait);
|
||||||
mutex_init(&hwdep->open_mutex);
|
mutex_init(&hwdep->open_mutex);
|
||||||
|
|
|
@ -1212,10 +1212,8 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
|
||||||
/* not changed */
|
/* not changed */
|
||||||
goto __unlock;
|
goto __unlock;
|
||||||
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
||||||
if (! tbl) {
|
if (!tbl)
|
||||||
pr_err("ALSA: mixer_oss: no memory\n");
|
|
||||||
goto __unlock;
|
goto __unlock;
|
||||||
}
|
|
||||||
tbl->oss_id = ch;
|
tbl->oss_id = ch;
|
||||||
tbl->name = kstrdup(str, GFP_KERNEL);
|
tbl->name = kstrdup(str, GFP_KERNEL);
|
||||||
if (! tbl->name) {
|
if (! tbl->name) {
|
||||||
|
|
|
@ -854,7 +854,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
||||||
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
||||||
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
||||||
if (!sw_params || !params || !sparams) {
|
if (!sw_params || !params || !sparams) {
|
||||||
pcm_dbg(substream->pcm, "No memory\n");
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,11 +343,8 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||||
if (! info) {
|
if (!info)
|
||||||
pcm_dbg(substream->pcm,
|
|
||||||
"snd_pcm_proc_info_read: cannot malloc\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
err = snd_pcm_info(substream, info);
|
err = snd_pcm_info(substream, info);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -717,10 +714,8 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
for (idx = 0, prev = NULL; idx < substream_count; idx++) {
|
for (idx = 0, prev = NULL; idx < substream_count; idx++) {
|
||||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||||
if (substream == NULL) {
|
if (!substream)
|
||||||
pcm_err(pcm, "Cannot allocate PCM substream\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
substream->pcm = pcm;
|
substream->pcm = pcm;
|
||||||
substream->pstr = pstr;
|
substream->pstr = pstr;
|
||||||
substream->number = idx;
|
substream->number = idx;
|
||||||
|
@ -774,10 +769,8 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
|
||||||
if (rpcm)
|
if (rpcm)
|
||||||
*rpcm = NULL;
|
*rpcm = NULL;
|
||||||
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
|
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
|
||||||
if (pcm == NULL) {
|
if (!pcm)
|
||||||
dev_err(card->dev, "Cannot allocate PCM\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
pcm->card = card;
|
pcm->card = card;
|
||||||
pcm->device = device;
|
pcm->device = device;
|
||||||
pcm->internal = internal;
|
pcm->internal = internal;
|
||||||
|
|
|
@ -1429,10 +1429,8 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
|
||||||
|
|
||||||
for (idx = 0; idx < count; idx++) {
|
for (idx = 0; idx < count; idx++) {
|
||||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||||
if (substream == NULL) {
|
if (!substream)
|
||||||
rmidi_err(rmidi, "rawmidi: cannot allocate substream\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
substream->stream = direction;
|
substream->stream = direction;
|
||||||
substream->number = idx;
|
substream->number = idx;
|
||||||
substream->rmidi = rmidi;
|
substream->rmidi = rmidi;
|
||||||
|
@ -1479,10 +1477,8 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
|
||||||
if (rrawmidi)
|
if (rrawmidi)
|
||||||
*rrawmidi = NULL;
|
*rrawmidi = NULL;
|
||||||
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
|
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
|
||||||
if (rmidi == NULL) {
|
if (!rmidi)
|
||||||
dev_err(card->dev, "rawmidi: cannot allocate\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
rmidi->card = card;
|
rmidi->card = card;
|
||||||
rmidi->device = device;
|
rmidi->device = device;
|
||||||
mutex_init(&rmidi->open_mutex);
|
mutex_init(&rmidi->open_mutex);
|
||||||
|
|
|
@ -774,10 +774,8 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
|
||||||
if (rtimer)
|
if (rtimer)
|
||||||
*rtimer = NULL;
|
*rtimer = NULL;
|
||||||
timer = kzalloc(sizeof(*timer), GFP_KERNEL);
|
timer = kzalloc(sizeof(*timer), GFP_KERNEL);
|
||||||
if (timer == NULL) {
|
if (!timer)
|
||||||
pr_err("ALSA: timer: cannot allocate\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
timer->tmr_class = tid->dev_class;
|
timer->tmr_class = tid->dev_class;
|
||||||
timer->card = card;
|
timer->card = card;
|
||||||
timer->tmr_device = tid->device;
|
timer->tmr_device = tid->device;
|
||||||
|
|
Loading…
Reference in New Issue