mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
c023b90699
commit
1e743997fb
|
@ -259,18 +259,14 @@ static int power_supply_check_supplies(struct power_supply *psy)
|
||||||
/* All supplies found, allocate char ** array for filling */
|
/* All supplies found, allocate char ** array for filling */
|
||||||
psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(psy->supplied_from),
|
psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(psy->supplied_from),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!psy->supplied_from) {
|
if (!psy->supplied_from)
|
||||||
dev_err(&psy->dev, "Couldn't allocate memory for supply list\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
*psy->supplied_from = devm_kzalloc(&psy->dev,
|
*psy->supplied_from = devm_kzalloc(&psy->dev,
|
||||||
sizeof(char *) * (cnt - 1),
|
sizeof(char *) * (cnt - 1),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!*psy->supplied_from) {
|
if (!*psy->supplied_from)
|
||||||
dev_err(&psy->dev, "Couldn't allocate memory for supply list\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
return power_supply_populate_supplied_from(psy);
|
return power_supply_populate_supplied_from(psy);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue