[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170829084518.l5dk3yfflgiagv7g@earth>
Date: Tue, 29 Aug 2017 10:45:18 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.co.uk>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: linux-pm@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] power: supply: core: Delete two error messages for a
failed memory allocation in power_supply_check_supplies()
Hi,
On Sat, Aug 26, 2017 at 07:37:00PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> 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 <elfring@...rs.sourceforge.net>
> ---
Thanks, queued.
-- Sebastian
> 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);
> }
> --
> 2.14.0
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists