greybus: power_supply: fix lock imbalance in init error path
Make sure to release the supplies_lock before returning on errors in gb_power_supplies_setup(). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
a463fc1533
commit
e0d91ff127
@ -644,8 +644,10 @@ static int gb_power_supplies_setup(struct gb_power_supplies *supplies)
|
||||
sizeof(struct gb_power_supply),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!supplies->supply)
|
||||
return -ENOMEM;
|
||||
if (!supplies->supply) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < supplies->supplies_count; i++) {
|
||||
ret = gb_power_supply_config(supplies, i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user