* [PATCH] power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies()
@ 2017-08-26 17:37 SF Markus Elfring
2017-08-29 8:45 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2017-08-26 17:37 UTC (permalink / raw)
To: linux-pm, Sebastian Reichel; +Cc: LKML, kernel-janitors
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies()
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
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-08-29 8:45 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: linux-pm, LKML, kernel-janitors
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-29 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).