From: Andy Shevchenko Date: Mon, 25 Jul 2011 14:16:41 +0000 (-0300) Subject: [media] adp1653: check platform_data before usage X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=572064280ecc9dc89227cf3797bc2144896a34f5;p=linux-beck.git [media] adp1653: check platform_data before usage 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 Cc: Mauro Carvalho Chehab Cc: Sakari Ailus Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c index be7befd60947..8ad89ffe2cc3 100644 --- a/drivers/media/video/adp1653.c +++ b/drivers/media/video/adp1653.c @@ -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;