Commit e2b56397 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] v4l: mt9t001: fix clean up in case of power-on failures

If the driver fails to reset the camera or to set up control handlers, it
has to power the camera back off.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 80d23ff6
...@@ -233,10 +233,21 @@ static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on) ...@@ -233,10 +233,21 @@ static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on)
ret = mt9t001_reset(mt9t001); ret = mt9t001_reset(mt9t001);
if (ret < 0) { if (ret < 0) {
dev_err(&client->dev, "Failed to reset the camera\n"); dev_err(&client->dev, "Failed to reset the camera\n");
return ret; goto e_power;
} }
return v4l2_ctrl_handler_setup(&mt9t001->ctrls); ret = v4l2_ctrl_handler_setup(&mt9t001->ctrls);
if (ret < 0) {
dev_err(&client->dev, "Failed to set up control handlers\n");
goto e_power;
}
return 0;
e_power:
mt9t001_power_off(mt9t001);
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