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