浏览代码

[media] tvp514x: Check v4l2_of_parse_endpoint() return value

The v4l2_of_parse_endpoint() function can fail so check the return value.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Javier Martinez Canillas 9 年之前
父节点
当前提交
fe1e6ac614
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/media/i2c/tvp514x.c

+ 4 - 2
drivers/media/i2c/tvp514x.c

@@ -1001,7 +1001,7 @@ static struct tvp514x_decoder tvp514x_dev = {
 static struct tvp514x_platform_data *
 static struct tvp514x_platform_data *
 tvp514x_get_pdata(struct i2c_client *client)
 tvp514x_get_pdata(struct i2c_client *client)
 {
 {
-	struct tvp514x_platform_data *pdata;
+	struct tvp514x_platform_data *pdata = NULL;
 	struct v4l2_of_endpoint bus_cfg;
 	struct v4l2_of_endpoint bus_cfg;
 	struct device_node *endpoint;
 	struct device_node *endpoint;
 	unsigned int flags;
 	unsigned int flags;
@@ -1013,11 +1013,13 @@ tvp514x_get_pdata(struct i2c_client *client)
 	if (!endpoint)
 	if (!endpoint)
 		return NULL;
 		return NULL;
 
 
+	if (v4l2_of_parse_endpoint(endpoint, &bus_cfg))
+		goto done;
+
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
 	if (!pdata)
 		goto done;
 		goto done;
 
 
-	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
 	flags = bus_cfg.bus.parallel.flags;
 	flags = bus_cfg.bus.parallel.flags;
 
 
 	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
 	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)