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:
Rui Miguel Silva 2016-01-08 13:53:42 +00:00 committed by Greg Kroah-Hartman
parent e0d91ff127
commit 7ccac20d59

View File

@ -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]);