From: Rui Miguel Silva Date: Fri, 8 Jan 2016 13:53:42 +0000 (+0000) Subject: greybus: power_supply: do not release failed supply alloc X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7ccac20d59ca45a2efea93a24a99d57022ff8911;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Reported-by: Johan Hovold Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index 1f3884bccf97..1ce57f6333da 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -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]);