power: supply: core: Delete two error messages for a failed memory allocation in...
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 26 Aug 2017 17:22:32 +0000 (19:22 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>
Mon, 28 Aug 2017 16:50:39 +0000 (18:50 +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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/power/supply/power_supply_core.c

index 0741fce..df5374a 100644 (file)
@@ -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);
 }