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 <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:44 +00:00 committed by Greg Kroah-Hartman
parent ff85f723ca
commit 23f25ba6ed

View File

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