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


Groups > linux.kernel > #1708677

[PATCH] ASoC: compress: Delete error messages for a failed memory allocation in snd_soc_new_compress()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH] ASoC: compress: Delete error messages for a failed memory allocation in snd_soc_new_compress()
Date 2017-08-10 16:30 +0200
Message-ID <ucWDg-6RR-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 10 Aug 2017 16:21:34 +0200

Omit extra messages for a memory allocation failure in this function.

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/soc/soc-compress.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 206f36bf43e8..6c867d50e036 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -764,15 +764,12 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
 		direction = SND_COMPRESS_CAPTURE;
 
 	compr = kzalloc(sizeof(*compr), GFP_KERNEL);
-	if (compr == NULL) {
-		snd_printk(KERN_ERR "Cannot allocate compr\n");
+	if (!compr)
 		return -ENOMEM;
-	}
 
 	compr->ops = devm_kzalloc(rtd->card->dev, sizeof(soc_compr_ops),
 				  GFP_KERNEL);
-	if (compr->ops == NULL) {
-		dev_err(rtd->card->dev, "Cannot allocate compressed ops\n");
+	if (!compr->ops) {
 		ret = -ENOMEM;
 		goto compr_err;
 	}
-- 
2.14.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ASoC: compress: Delete error messages for a failed memory  allocation in snd_soc_new_compress() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-10 16:30 +0200
  Applied "ASoC: compress: Delete error messages for a failed memory allocation in snd_soc_new_compress()" to the asoc tree Mark Brown <broonie@kernel.org> - 2017-08-10 17:50 +0200

csiph-web