]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] adp1653: check error code of adp1653_init_controls
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 28 Jul 2011 07:59:38 +0000 (04:59 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 6 Aug 2011 12:43:57 +0000 (09:43 -0300)
Potentially the adp1653_init_controls could return an error. In our case the
error was ignored, meanwhile it means incorrect initialization of V4L2
controls. Additionally we have to free control handler structures in case of
apd1653_init_controls or media_entity_init failure.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/adp1653.c

index 8ad89ffe2cc3863ecb1ae4d84308ded531efeade..279d75d38188973df832e64beb7e454d308e56ad 100644 (file)
@@ -429,12 +429,19 @@ static int adp1653_probe(struct i2c_client *client,
        flash->subdev.internal_ops = &adp1653_internal_ops;
        flash->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
-       adp1653_init_controls(flash);
+       ret = adp1653_init_controls(flash);
+       if (ret)
+               goto free_and_quit;
 
        ret = media_entity_init(&flash->subdev.entity, 0, NULL, 0);
        if (ret < 0)
-               kfree(flash);
+               goto free_and_quit;
 
+       return 0;
+
+free_and_quit:
+       v4l2_ctrl_handler_free(&flash->ctrls);
+       kfree(flash);
        return ret;
 }