diff options
author | Éric Piel <eric.piel@tremplin-utc.net> | 2011-11-01 00:10:54 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-01 00:30:52 (GMT) |
commit | 0021586b958d7eb5d73dbb9c42a0b4f19ebe3a9e (patch) | |
tree | 5bd2480a864e1f0d2107e48d16988b4676516bff /drivers/misc/lis3lv02d | |
parent | d0b6a971ed034054897df42f3e3000b4f57cccc5 (diff) | |
download | linux-0021586b958d7eb5d73dbb9c42a0b4f19ebe3a9e.tar.xz |
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')
-rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c index b20dfb4..ea9159c 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(); |