Commit 04bc4f66 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

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: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 9a57d72b
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment