From: Éric Piel Date: Tue, 1 Nov 2011 00:10:54 +0000 (-0700) Subject: lis3: free regulators if probe() fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0021586b958d7eb5d73dbb9c42a0b4f19ebe3a9e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git lis3: free regulators if probe() fails Signed-off-by: Ilkka Koskinen Signed-off-by: Éric Piel Cc: Matthew Garrett Cc: Witold Pilat Cc: Lyall Pearce Cc: Malte Starostik Cc: Thadeu Lima de Souza Cascardo Cc: Christian Lamparter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c index b20dfb4522d2..ea9159c65b58 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c @@ -161,8 +161,13 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, if (lis3_dev.reg_ctrl) lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF); - if (ret == 0) - return 0; + if (ret) + goto fail2; + return 0; + +fail2: + regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators), + lis3_dev.regulators); fail: if (pdata && pdata->release_resources) pdata->release_resources();