summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/mt9t001.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2015-12-14 07:58:29 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-28 07:55:39 -0300
commite2b563971462f4f951577ce8dfe288f92735190e (patch)
treedcce5e4c8e535b6e5698f98b37d3a1328a050f35 /drivers/media/i2c/mt9t001.c
parent80d23ff6b39862055eef9665fc602e99bc6dc180 (diff)
downloadlinux-e2b563971462f4f951577ce8dfe288f92735190e.tar.bz2
[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: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/mt9t001.c')
-rw-r--r--drivers/media/i2c/mt9t001.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 16b8c702cf13..842017fa4aab 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;
}
/* -----------------------------------------------------------------------------