* [PATCH] mt9t001: fix clean up in case of power-on failures
@ 2015-12-14 9:58 Guennadi Liakhovetski
2015-12-14 20:41 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Guennadi Liakhovetski @ 2015-12-14 9:58 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: Laurent Pinchart
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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/media/i2c/mt9t001.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 8ae99f7..f262cf2 100644
--- a/drivers/media/i2c/mt9t001.c
+++ b/drivers/media/i2c/mt9t001.c
@@ -233,10 +233,21 @@ static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on)
ret = mt9t001_reset(mt9t001);
if (ret < 0) {
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;
}
/* -----------------------------------------------------------------------------
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mt9t001: fix clean up in case of power-on failures
2015-12-14 9:58 [PATCH] mt9t001: fix clean up in case of power-on failures Guennadi Liakhovetski
@ 2015-12-14 20:41 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2015-12-14 20:41 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: Linux Media Mailing List
Hi Guennadi,
Thank you for the patch.
On Monday 14 December 2015 10:58:29 Guennadi Liakhovetski wrote:
> 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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
and applied to my tree.
> ---
> drivers/media/i2c/mt9t001.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
> index 8ae99f7..f262cf2 100644
> --- a/drivers/media/i2c/mt9t001.c
> +++ b/drivers/media/i2c/mt9t001.c
> @@ -233,10 +233,21 @@ static int __mt9t001_set_power(struct mt9t001
> *mt9t001, bool on) ret = mt9t001_reset(mt9t001);
> if (ret < 0) {
> 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;
> }
>
> /*
> ---------------------------------------------------------------------------
> --
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-14 20:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 9:58 [PATCH] mt9t001: fix clean up in case of power-on failures Guennadi Liakhovetski
2015-12-14 20:41 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox