lis3: free regulators if probe() fails
authorÉric Piel <[email protected]>
Tue, 1 Nov 2011 00:10:54 +0000 (17:10 -0700)
committerLinus Torvalds <[email protected]>
Tue, 1 Nov 2011 00:30:52 +0000 (17:30 -0700)
Signed-off-by: Ilkka Koskinen <[email protected]>
Signed-off-by: Éric Piel <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Witold Pilat <[email protected]>
Cc: Lyall Pearce <[email protected]>
Cc: Malte Starostik <[email protected]>
Cc: Thadeu Lima de Souza Cascardo <[email protected]>
Cc: Christian Lamparter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/misc/lis3lv02d/lis3lv02d_i2c.c

index b20dfb4522d278eebefa6eb8f2242e78c32f3f8d..ea9159c65b58d84f562f6eda2ddf1663b19a5597 100644 (file)
@@ -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();