From: Markus Elfring Date: Thu, 10 Aug 2017 14:21:34 +0000 (+0200) Subject: ASoC: compress: Delete error messages for a failed memory allocation in snd_soc_new_c... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7a0cf42edd9cc335572aa8614df0ebefa2f537be;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ASoC: compress: Delete error messages for a failed memory allocation in snd_soc_new_compress() 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 Signed-off-by: Mark Brown --- 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; }