Linux Power Management development
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-pm@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies()
Date: Tue, 29 Aug 2017 10:45:18 +0200	[thread overview]
Message-ID: <20170829084518.l5dk3yfflgiagv7g@earth> (raw)
In-Reply-To: <5f2600b3-e498-af9f-32b3-b41ebd81159b@users.sourceforge.net>

[-- Attachment #1: Type: text/plain, Size: 1577 bytes --]

Hi,

On Sat, Aug 26, 2017 at 07:37:00PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-08-29  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 17:37 [PATCH] power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies() SF Markus Elfring
2017-08-29  8:45 ` Sebastian Reichel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170829084518.l5dk3yfflgiagv7g@earth \
    --to=sebastian.reichel@collabora.co.uk \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox