Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e743997 authored by Markus Elfring's avatar Markus Elfring Committed by Sebastian Reichel
Browse files

power: supply: core: Delete two error messages for a failed memory allocation...


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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent c023b906
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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);
}