From patchwork Sat Aug 26 17:37:00 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: 9923591 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 9C046603FA for ; Sat, 26 Aug 2017 17:37:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74BF3285DA for ; Sat, 26 Aug 2017 17:37:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FD9E285D2; Sat, 26 Aug 2017 17:37:12 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF9AD285D2 for ; Sat, 26 Aug 2017 17:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750818AbdHZRhG (ORCPT ); Sat, 26 Aug 2017 13:37:06 -0400 Received: from mout.web.de ([212.227.17.11]:60386 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbdHZRhF (ORCPT ); Sat, 26 Aug 2017 13:37:05 -0400 Received: from [192.168.1.2] ([85.182.38.188]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lh6QF-1d9Fmd3srX-00oSgo; Sat, 26 Aug 2017 19:37:01 +0200 To: linux-pm@vger.kernel.org, Sebastian Reichel Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies() Message-ID: <5f2600b3-e498-af9f-32b3-b41ebd81159b@users.sourceforge.net> Date: Sat, 26 Aug 2017 19:37:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:s3DjlOLIVsIIrH+2H5ML16xOd1QJpZAvVLjFgECbm4p9DtlV1wn Igh2/APeS/djY+KipGkqxrw7sOG1yk8OQN9HFEzZePIvj3Pe7ofrVu/72sqd3YGByOiBlzv J9HD/8SPNALFjravAu6xs5hcgP5FcpKixraPHHuZb3aKmiJ+bg+fenFUh40u1rOiYXYmsYv rEW1DtnFj5rndg0eupOSA== X-UI-Out-Filterresults: notjunk:1; V01:K0:CXfH9vOvjcQ=:Ag6KcOuFwFerrtyG5kU6wF ZIpXoPMBPWCfiNrajkfwyQ/Ey3iEZ+rZh3mLbtdITDRNl5rMN2PkJMDrmBMF9sgKO/yL7azea I5kcPCN77wGwIxZ0B0cP+5PzOZGuE8fOg66fUdVjhebSaDfeubokgj7j9wz6QthvyROpJzSqW PSv0yVSp/rt7wJ9nLbHLGNa2cXTrAvrraXUkMrfotms+mIrEHFgdbWnkeJh0rbdb30dYlB1bn 0+PspfConRtiiXaCFlXZRxUYQIsfr4W4GRP30MuIlzsHz3Ennnm/vRIImWiJLu4vq2AhGJs+7 R8d83bMdtZ7k0VLAZ81YD8Ps811/4klhTCsEHsQS+4hpJP3w+h2SvkUAvv2yj7+c0UG88AzpW wzrF7G6Is5PMcJVpqi05zZEb1fDoTbctzgR9Sjj9MXOCBll3dXNli7LGWoMoFEcHIubM0Zm0b qEdBODQZ6/8OaLMw2MzEphs4r7JC1kujMxhs+GAzVzN15CifvfhB8sYT29Q+H8pCnj0nSHgyw DESc9fcZqX+2sX9+V6OEp62cWhUsB5c36PdUWLnLslwfygzfc/WJtFoQyWj3AgWQqr0pGJxP1 pG2lmIQ7qaZ8azEPsgjYtHXzN2y9YYsvYgO3IAl2LYyKnlJ0ArNaETOUYGX9CgI/aCR433+xS 1c0Nprx6/FQOPGsNNAoGLegyT91MPImEbAt/+PrVcJSP10gyWnTpxe/wpaLPP/Np9HylKFeJk PAMnGydN+kYLck29KAAMlfaaNLmokOSTGsNE5SXsd0jp5xJ/NfITZ8UrXvD0pHH+ub5VVl3lt ARSkpVh8GvEykJIixT6GqsSjTIyxTKksB8YYDyW8HplYGH7xsA= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 26 Aug 2017 19:22:32 +0200 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 --- drivers/power/supply/power_supply_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 540d3e0aa011..3d46863baa52 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -259,18 +259,14 @@ static int power_supply_check_supplies(struct power_supply *psy) /* All supplies found, allocate char ** array for filling */ psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(psy->supplied_from), GFP_KERNEL); - if (!psy->supplied_from) { - dev_err(&psy->dev, "Couldn't allocate memory for supply list\n"); + if (!psy->supplied_from) return -ENOMEM; - } *psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(char *) * (cnt - 1), GFP_KERNEL); - if (!*psy->supplied_from) { - dev_err(&psy->dev, "Couldn't allocate memory for supply list\n"); + if (!*psy->supplied_from) return -ENOMEM; - } return power_supply_populate_supplied_from(psy); }