[media] adp1653: check platform_data before usage
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 25 Jul 2011 14:16:41 +0000 (11:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 6 Aug 2011 12:42:50 +0000 (09:42 -0300)
The driver requires platform_data to be present. That's why we need to check
and fail in case of the absence of necessary data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
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 be7befd..8ad89ff 100644 (file)
@@ -413,6 +413,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;