aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2018-04-12 06:16:39 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-04-23 13:58:04 -0400
commit80a1f95b8a6fe14b0c4b1f688b3a5d7170936e2c (patch)
treec150bc0ca945ca401cf513168a8a92c05b746468 /drivers/media/i2c
parentmedia: ov7740: Check for possible NULL return value in control creation (diff)
downloadlinux-dev-80a1f95b8a6fe14b0c4b1f688b3a5d7170936e2c.tar.xz
linux-dev-80a1f95b8a6fe14b0c4b1f688b3a5d7170936e2c.zip
media: ov7740: Fix control handler error at the end of control init
Check that no error happened during adding controls to the driver's control handler. Print an error message and bail out if there was one. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ov7740.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index cbfa5a3327f6..3dad33c6180f 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -1006,6 +1006,13 @@ static int ov7740_init_controls(struct ov7740 *ov7740)
V4L2_EXPOSURE_MANUAL, false);
v4l2_ctrl_cluster(2, &ov7740->hflip);
+ if (ctrl_hdlr->error) {
+ ret = ctrl_hdlr->error;
+ dev_err(&client->dev, "controls initialisation failed (%d)\n",
+ ret);
+ goto error;
+ }
+
ret = v4l2_ctrl_handler_setup(ctrl_hdlr);
if (ret) {
dev_err(&client->dev, "%s control init failed (%d)\n",