]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ALSA: core: Drop superfluous error/debug messages after malloc failures
authorTakashi Iwai <tiwai@suse.de>
Tue, 10 Mar 2015 14:42:14 +0000 (15:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 10 Mar 2015 14:42:14 +0000 (15:42 +0100)
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>
sound/core/control.c
sound/core/device.c
sound/core/hwdep.c
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/pcm.c
sound/core/rawmidi.c
sound/core/timer.c

index e1d8e0c816f081c016415b5584730e884be9e4e3..833b223a363a0324b20eae0adf204242f43ea114 100644 (file)
@@ -217,10 +217,8 @@ static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
        size += sizeof(struct snd_kcontrol_volatile) * count;
 
        *kctl = kzalloc(size, GFP_KERNEL);
-       if (*kctl == NULL) {
-               pr_err("ALSA: Cannot allocate control instance\n");
+       if (!*kctl)
                return -ENOMEM;
-       }
 
        for (idx = 0; idx < count; idx++) {
                (*kctl)->vd[idx].access = access;
index 41bec3075ae5b829c6f032520da7062c6214f662..c1a845b42a8bd47f0bd50a340b6253fdf200e9a2 100644 (file)
@@ -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))
                return -ENXIO;
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-       if (dev == NULL) {
-               dev_err(card->dev, "Cannot allocate device, type=%d\n", type);
+       if (!dev)
                return -ENOMEM;
-       }
        INIT_LIST_HEAD(&dev->list);
        dev->card = card;
        dev->type = type;
index 84244a5143cfe91fb53c5cfc1e2f9f5818d588aa..51692c8a39ea1b5fe99ab197e47c29dc16aaf86f 100644 (file)
@@ -378,10 +378,8 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
        if (rhwdep)
                *rhwdep = NULL;
        hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
-       if (hwdep == NULL) {
-               dev_err(card->dev, "hwdep: cannot allocate\n");
+       if (!hwdep)
                return -ENOMEM;
-       }
 
        init_waitqueue_head(&hwdep->open_wait);
        mutex_init(&hwdep->open_mutex);
index 5e6349f00ecd770a3c572ef950454ec04f13e1c8..056f8e27485181208a85fd2142cd7f13297a3a6d 100644 (file)
@@ -1212,10 +1212,8 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
                        /* not changed */
                        goto __unlock;
                tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
-               if (! tbl) {
-                       pr_err("ALSA: mixer_oss: no memory\n");
+               if (!tbl)
                        goto __unlock;
-               }
                tbl->oss_id = ch;
                tbl->name = kstrdup(str, GFP_KERNEL);
                if (! tbl->name) {
index 80423a4ccab621b04d0c0fbdbe3bdeafc67a7e3b..58550cc93f2805aa8627f9e3e4588c2838281926 100644 (file)
@@ -854,7 +854,6 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
        params = kmalloc(sizeof(*params), GFP_KERNEL);
        sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
        if (!sw_params || !params || !sparams) {
-               pcm_dbg(substream->pcm, "No memory\n");
                err = -ENOMEM;
                goto failure;
        }
index e9b87465c73da6f051ab17bb7125a929aa20656f..b25bcf5b8644636f05eacb3f38bcae2ad462f6f6 100644 (file)
@@ -343,11 +343,8 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
                return;
 
        info = kmalloc(sizeof(*info), GFP_KERNEL);
-       if (! info) {
-               pcm_dbg(substream->pcm,
-                       "snd_pcm_proc_info_read: cannot malloc\n");
+       if (!info)
                return;
-       }
 
        err = snd_pcm_info(substream, info);
        if (err < 0) {
@@ -717,10 +714,8 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
        prev = NULL;
        for (idx = 0, prev = NULL; idx < substream_count; idx++) {
                substream = kzalloc(sizeof(*substream), GFP_KERNEL);
-               if (substream == NULL) {
-                       pcm_err(pcm, "Cannot allocate PCM substream\n");
+               if (!substream)
                        return -ENOMEM;
-               }
                substream->pcm = pcm;
                substream->pstr = pstr;
                substream->number = idx;
@@ -774,10 +769,8 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
        if (rpcm)
                *rpcm = NULL;
        pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
-       if (pcm == NULL) {
-               dev_err(card->dev, "Cannot allocate PCM\n");
+       if (!pcm)
                return -ENOMEM;
-       }
        pcm->card = card;
        pcm->device = device;
        pcm->internal = internal;
index b5a748596fc40dda977e437b2ed6a6b87c4321b3..a7759846fbaadff0c9493760ce7b14eff7ca8ad9 100644 (file)
@@ -1429,10 +1429,8 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
 
        for (idx = 0; idx < count; idx++) {
                substream = kzalloc(sizeof(*substream), GFP_KERNEL);
-               if (substream == NULL) {
-                       rmidi_err(rmidi, "rawmidi: cannot allocate substream\n");
+               if (!substream)
                        return -ENOMEM;
-               }
                substream->stream = direction;
                substream->number = idx;
                substream->rmidi = rmidi;
@@ -1479,10 +1477,8 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
        if (rrawmidi)
                *rrawmidi = NULL;
        rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
-       if (rmidi == NULL) {
-               dev_err(card->dev, "rawmidi: cannot allocate\n");
+       if (!rmidi)
                return -ENOMEM;
-       }
        rmidi->card = card;
        rmidi->device = device;
        mutex_init(&rmidi->open_mutex);
index 490b489d713d4c892af0689d4eafb32cde2131c1..a9a1a047c521ff510949f87ca21c192df9497187 100644 (file)
@@ -774,10 +774,8 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
        if (rtimer)
                *rtimer = NULL;
        timer = kzalloc(sizeof(*timer), GFP_KERNEL);
-       if (timer == NULL) {
-               pr_err("ALSA: timer: cannot allocate\n");
+       if (!timer)
                return -ENOMEM;
-       }
        timer->tmr_class = tid->dev_class;
        timer->card = card;
        timer->tmr_device = tid->device;