Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / drivers / media / video / adp1653.c
index c259494..12eedf4 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/version.h>
 #include <media/adp1653.h>
@@ -259,7 +260,7 @@ static int adp1653_init_controls(struct adp1653_flash *flash)
        if (flash->ctrls.error)
                return flash->ctrls.error;
 
-       fault->is_volatile = 1;
+       fault->flags |= V4L2_CTRL_FLAG_VOLATILE;
 
        flash->subdev.ctrl_handler = &flash->ctrls;
        return 0;
@@ -414,6 +415,10 @@ static int adp1653_probe(struct i2c_client *client,
        struct adp1653_flash *flash;
        int ret;
 
+       /* we couldn't work without platform data */
+       if (client->dev.platform_data == NULL)
+               return -ENODEV;
+
        flash = kzalloc(sizeof(*flash), GFP_KERNEL);
        if (flash == NULL)
                return -ENOMEM;
@@ -426,12 +431,21 @@ 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;
 
+       flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+
+       return 0;
+
+free_and_quit:
+       v4l2_ctrl_handler_free(&flash->ctrls);
+       kfree(flash);
        return ret;
 }