aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
diff options
context:
space:
mode:
authorÉric Piel <eric.piel@tremplin-utc.net>2011-10-31 20:10:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:52 -0400
commit0021586b958d7eb5d73dbb9c42a0b4f19ebe3a9e (patch)
tree5bd2480a864e1f0d2107e48d16988b4676516bff /drivers/misc/lis3lv02d/lis3lv02d_i2c.c
parentd0b6a971ed034054897df42f3e3000b4f57cccc5 (diff)
lis3: free regulators if probe() fails
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@nokia.com> Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Cc: Matthew Garrett <mjg@redhat.com> Cc: Witold Pilat <witold.pilat@gmail.com> Cc: Lyall Pearce <lyall.pearce@hp.com> Cc: Malte Starostik <m-starostik@versanet.de> Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Cc: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/lis3lv02d/lis3lv02d_i2c.c')
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d_i2c.c9
1 files changed, 7 insertions, 2 deletions
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,
161 if (lis3_dev.reg_ctrl) 161 if (lis3_dev.reg_ctrl)
162 lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF); 162 lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);
163 163
164 if (ret == 0) 164 if (ret)
165 return 0; 165 goto fail2;
166 return 0;
167
168fail2:
169 regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators),
170 lis3_dev.regulators);
166fail: 171fail:
167 if (pdata && pdata->release_resources) 172 if (pdata && pdata->release_resources)
168 pdata->release_resources(); 173 pdata->release_resources();