ALSA: usb: Delete an error message for a failed memory allocation in two functions
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 11 Aug 2017 16:38:25 +0000 (18:38 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Aug 2017 21:20:55 +0000 (23:20 +0200)
Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/quirks.c
sound/usb/stream.c

index d7b0b0a..9db40d5 100644 (file)
@@ -146,10 +146,9 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
        unsigned *rate_table = NULL;
 
        fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
-       if (!fp) {
-               usb_audio_err(chip, "cannot memdup\n");
+       if (!fp)
                return -ENOMEM;
-       }
+
        INIT_LIST_HEAD(&fp->list);
        if (fp->nr_rates > MAX_NR_RATES) {
                kfree(fp);
index 8e9548b..d1776e5 100644 (file)
@@ -658,10 +658,8 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
                        continue;
 
                fp = kzalloc(sizeof(*fp), GFP_KERNEL);
-               if (! fp) {
-                       dev_err(&dev->dev, "cannot malloc\n");
+               if (!fp)
                        return -ENOMEM;
-               }
 
                fp->iface = iface_no;
                fp->altsetting = altno;