Commit 85e86c6e authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] soc_camera: fix compiler warning

media_build/v4l/soc_camera.c: In function 'soc_camera_host_register':
media_build/v4l/soc_camera.c:1513:10: warning: 'sasd' may be used uninitialized in this function [-Wmaybe-uninitialized]
  snprintf(clk_name, sizeof(clk_name), "%d-%04x",
          ^
media_build/v4l/soc_camera.c:1464:34: note: 'sasd' was declared here
  struct soc_camera_async_subdev *sasd;
                                  ^
By changing the type of 'i' to unsigned and changing a condition we finally
convince the compiler that sasd is really initialized.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 73135e96
...@@ -1466,7 +1466,8 @@ static int scan_async_group(struct soc_camera_host *ici, ...@@ -1466,7 +1466,8 @@ static int scan_async_group(struct soc_camera_host *ici,
struct soc_camera_device *icd; struct soc_camera_device *icd;
struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,};
char clk_name[V4L2_SUBDEV_NAME_SIZE]; char clk_name[V4L2_SUBDEV_NAME_SIZE];
int ret, i; unsigned int i;
int ret;
/* First look for a sensor */ /* First look for a sensor */
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
...@@ -1475,7 +1476,7 @@ static int scan_async_group(struct soc_camera_host *ici, ...@@ -1475,7 +1476,7 @@ static int scan_async_group(struct soc_camera_host *ici,
break; break;
} }
if (i == size || asd[i]->match_type != V4L2_ASYNC_MATCH_I2C) { if (i >= size || asd[i]->match_type != V4L2_ASYNC_MATCH_I2C) {
/* All useless */ /* All useless */
dev_err(ici->v4l2_dev.dev, "No I2C data source found!\n"); dev_err(ici->v4l2_dev.dev, "No I2C data source found!\n");
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment