diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2019-05-31 22:12:49 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-06-24 17:12:16 +0200 |
commit | 04bc4f6631f7e47a9fe47ea6c0794ed56d9b3cf8 (patch) | |
tree | 8365e5dd5e395ca597d41ea342b7e93f7ec2bda0 /drivers/media/i2c/mt9m111.c | |
parent | media: mt9m111: No need to check for the regulator (diff) | |
download | linux-04bc4f6631f7e47a9fe47ea6c0794ed56d9b3cf8.tar.xz linux-04bc4f6631f7e47a9fe47ea6c0794ed56d9b3cf8.zip |
media: mt9m111: Fix error handling in mt9m111_power_on
The mt9m111_power_on function did not properly clean up whenever it
encountered an error. Do that now.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/mt9m111.c')
-rw-r--r-- | drivers/media/i2c/mt9m111.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index bb19f8c346cb..593ebe5e2cb6 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -986,13 +986,21 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111) ret = regulator_enable(mt9m111->regulator); if (ret < 0) - return ret; + goto out_clk_disable; ret = mt9m111_resume(mt9m111); - if (ret < 0) { - dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); - v4l2_clk_disable(mt9m111->clk); - } + if (ret < 0) + goto out_regulator_disable; + + return 0; + +out_regulator_disable: + regulator_disable(mt9m111->regulator); + +out_clk_disable: + v4l2_clk_disable(mt9m111->clk); + + dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); return ret; } |