From: Rui Miguel Silva Date: Fri, 8 Jan 2016 13:53:44 +0000 (+0000) Subject: greybus: power_supply: free supplies at release X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=23f25ba6edd4121eb70baf3df12f5592bee8a1e9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git greybus: power_supply: free supplies at release After freeing each individual power_supply, free the top controller, if not it will leak memory at each module insert/remove. 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 764d2f640164..7d1848b99d9b 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -579,6 +579,7 @@ static void _gb_power_supplies_release(struct gb_power_supplies *supplies) for (i = 0; i < supplies->supplies_count; i++) _gb_power_supply_release(&supplies->supply[i]); mutex_unlock(&supplies->supplies_lock); + kfree(supplies); } static int gb_power_supplies_get_count(struct gb_power_supplies *supplies)