mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-20 04:19:41 +00:00
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:
parent
ff85f723ca
commit
23f25ba6ed
@ -579,6 +579,7 @@ static void _gb_power_supplies_release(struct gb_power_supplies *supplies)
|
|||||||
for (i = 0; i < supplies->supplies_count; i++)
|
for (i = 0; i < supplies->supplies_count; i++)
|
||||||
_gb_power_supply_release(&supplies->supply[i]);
|
_gb_power_supply_release(&supplies->supply[i]);
|
||||||
mutex_unlock(&supplies->supplies_lock);
|
mutex_unlock(&supplies->supplies_lock);
|
||||||
|
kfree(supplies);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gb_power_supplies_get_count(struct gb_power_supplies *supplies)
|
static int gb_power_supplies_get_count(struct gb_power_supplies *supplies)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user