From e0d91ff127cf68e6369cfccd51af18b07bf462e3 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Thu, 7 Jan 2016 12:28:29 +0100 Subject: [PATCH] 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 Reviewed-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/power_supply.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index 4a7381650bb7..1f3884bccf97 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -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); -- 2.20.1