Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709862 > unrolled thread

[PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-08-11 19:10 +0200
Last post2017-08-12 23:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ALSA: usb: Delete an error message for a failed memory  allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-11 19:10 +0200
    Re: [PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions Takashi Iwai <tiwai@suse.de> - 2017-08-12 23:30 +0200

#1709862 — [PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-08-11 19:10 +0200
Subject[PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions
Message-ID<udlBD-6fZ-5@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 11 Aug 2017 18:38:25 +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>
---
 sound/usb/quirks.c | 5 ++---
 sound/usb/stream.c | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d7b0b0a3a2db..9db40d58b4e2 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -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);
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 8e9548bc1f1a..d1776e5517ff 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -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;
-- 
2.14.0

[toc] | [next] | [standalone]


#1710367 — Re: [PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions

FromTakashi Iwai <tiwai@suse.de>
Date2017-08-12 23:30 +0200
SubjectRe: [PATCH] ALSA: usb: Delete an error message for a failed memory allocation in two functions
Message-ID<udM8O-6gz-7@gated-at.bofh.it>
In reply to#1709862
On Fri, 11 Aug 2017 19:04:41 +0200,
SF Markus Elfring wrote:
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 11 Aug 2017 18:38:25 +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>

Applied, thanks.


Takashi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web