From patchwork Wed Nov 22 20:29:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10070909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84EBA601D5 for ; Wed, 22 Nov 2017 20:29:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76BAC29968 for ; Wed, 22 Nov 2017 20:29:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AF7529BA5; Wed, 22 Nov 2017 20:29:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD85629968 for ; Wed, 22 Nov 2017 20:29:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5CF562677C4; Wed, 22 Nov 2017 21:29:30 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D95322677C5; Wed, 22 Nov 2017 21:29:28 +0100 (CET) Received: from mout.web.de (mout.web.de [212.227.17.12]) by alsa0.perex.cz (Postfix) with ESMTP id 4FE00266F03 for ; Wed, 22 Nov 2017 21:29:27 +0100 (CET) Received: from [192.168.1.3] ([78.48.197.157]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MVtxM-1efkEo48Yy-00X3Dk; Wed, 22 Nov 2017 21:29:19 +0100 From: SF Markus Elfring To: alsa-devel@alsa-project.org, Brian Austin , Jaroslav Kysela , Liam Girdwood , Mark Brown , Paul Handrigan , Takashi Iwai References: Message-ID: <7e0b578a-e342-7c54-5eeb-f8dd427e59b5@users.sourceforge.net> Date: Wed, 22 Nov 2017 21:29:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:rEemMypmT2/PV7/iZ8bH4h7Hw+EDf4P5GbjxZyYxpLpiW9VFB0R jbuKRSCBxevkL0/ZQ9W3GN2MEAeVV0VkAQZak9Z6QOlIf2/Q7xf+XHKgk/ikLtRpy2tlnGE 3Xj0MbTRwxGl19s1j37od7Eyypm0NnHTCO8cRxVyVIIEy4MujACepoWEinrojJm/DTUgPBh 79xGjrv+R4xfrkdvCdLdA== X-UI-Out-Filterresults: notjunk:1; V01:K0:fSNLMAZxy1k=:qxtQ2uM33dxZ6PqAQKBmDZ spl28y5RFLeNxOM7xqzGG0D+SEQEDFuirCTzF9TJ6KPybc6z/AkxWPB5o5g9zvd8HgkD7jeq3 SP3VEWkr3KhS94ZKxl5hw+ZoKzgKdbtEB4a6Z/Mbv4V7unKnCoAUl51LK07juOMionrP53sYe W/S4CumC1S686fOpEybSPg5HtbQ2HAlA78asRr669dl8NeMFal9xTL7lkzz9FHmSXL6Hw7zlV tZfcXEYhdAgxf1fa6HVI25/catSocJpyhXRxWfvBIYhUudK2s63akSyq1huYx4vxG+y84PGrG Ma82oLHl5MhQON5uTcktje3tPcs4sLnAcT+1vBlVLCJGH9SyoOIM3YlyLfOvFv2Bau3QK/tZu jx3IaRnw8zl/foVoK4X4HtBWCI5yMMa2Qwu0yxy0lEhN48faLydXAjvtnSLzEG9WsQ/b5p/R4 LdTE8hOK737n9FRsIomKoW2NBT3M90RYzPQ8QKi/gSI3jkgjb0/QDjko5tcbdgUZ9N5mzK4ri nz6kgur0SwPE1oFCRjLssEezWlAcP5xXiWCewjj8i0n3CUa7jV1S8C8reC5TDnto+J83ekz3Z 5iFi0afMLqULhifMKAq/0dPcogR6Ms/I1hlYpFdmYtCi+br+ZOGV0u91/OKRdd5VuUacMndBj 4kTLytoMxD+hinZU6teapP8SGrLhBeCp1UauvWFDA4MQHxKAwSlbd35R32v2pQgxkQNPLXin0 A7tgGFG5sDmzKuBktFM6zT4BepzixiK6qzSv1gkk9NtD7D9tnDdOCrqdWhEPPLHXJuskR0Js0 lBDh9gWKKmKzAcU7OkvEYrRl7RsB/t8Gur4M86OgVpsnC+F34k= Cc: kernel-janitors@vger.kernel.org, LKML Subject: [alsa-devel] [PATCH 1/2] ASoC: cs35l34: Delete two error messages for a failed memory allocation in cs35l34_i2c_probe() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 22 Nov 2017 21:13:29 +0100 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- sound/soc/codecs/cs35l34.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c index 1e05026bedca..6cbdbbe53940 100644 --- a/sound/soc/codecs/cs35l34.c +++ b/sound/soc/codecs/cs35l34.c @@ -1007,10 +1007,8 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client, cs35l34 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs35l34_private), GFP_KERNEL); - if (!cs35l34) { - dev_err(&i2c_client->dev, "could not allocate codec\n"); + if (!cs35l34) return -ENOMEM; - } i2c_set_clientdata(i2c_client, cs35l34); cs35l34->regmap = devm_regmap_init_i2c(i2c_client, &cs35l34_regmap); @@ -1047,11 +1045,9 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client, pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs35l34_platform_data), GFP_KERNEL); - if (!pdata) { - dev_err(&i2c_client->dev, - "could not allocate pdata\n"); + if (!pdata) return -ENOMEM; - } + if (i2c_client->dev.of_node) { ret = cs35l34_handle_of_data(i2c_client, pdata); if (ret != 0)