Skip to content

Commit

Permalink
lis3: free regulators if probe() fails
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pieleric authored and torvalds committed Nov 1, 2011
1 parent d0b6a97 commit 0021586
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/misc/lis3lv02d/lis3lv02d_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0021586

Please sign in to comment.