mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-20 04:19:41 +00:00
greybus: power_supply: do not release failed supply alloc
If allocation of memory for each supply fail, we should get out of release any individual supply. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Reported-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
e0d91ff127
commit
7ccac20d59
@ -569,6 +569,9 @@ static void _gb_power_supplies_release(struct gb_power_supplies *supplies)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!supplies->supply)
|
||||
return;
|
||||
|
||||
mutex_lock(&supplies->supplies_lock);
|
||||
for (i = 0; i < supplies->supplies_count; i++)
|
||||
_gb_power_supply_release(&supplies->supply[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user