diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-26 19:22:32 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-08-28 18:50:39 +0200 |
commit | 1e743997fb9a56cbb34591f5fe88a74c14b8688d (patch) | |
tree | 644e6ea3e6b59fdf82006dea979e1f37e69f5010 /drivers/power | |
parent | power: supply: make device_attribute const (diff) | |
download | linux-1e743997fb9a56cbb34591f5fe88a74c14b8688d.tar.xz linux-1e743997fb9a56cbb34591f5fe88a74c14b8688d.zip |
power: supply: core: Delete two error messages for a failed memory allocation in power_supply_check_supplies()
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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/power_supply_core.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 0741fcef3b44..df5374afd214 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); } |