Commit f687f326 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] V4L2: soc-camera: fix uninitialised use compiler warning

In scan_async_group() if the size parameter is negative, the sasd pointer
will be used uninitialised:
drivers/media/platform/soc_camera/soc_camera.c: In function "soc_camera_host_register":
drivers/media/platform/soc_camera/soc_camera.c:1514:55: warning: "sasd" may
be used uninitialized in this function [-Wmaybe-uninitialized]
    sasd->asd.match.i2c.adapter_id, sasd->asd.match.i2c.address);
                                                       ^
drivers/media/platform/soc_camera/soc_camera.c:1464:34: note: "sasd" was
declared here
  struct soc_camera_async_subdev *sasd;
Fix this by making "size" and the array, from which it is assigned unsigned.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent fe05e141
...@@ -1459,7 +1459,7 @@ static int soc_camera_async_complete(struct v4l2_async_notifier *notifier) ...@@ -1459,7 +1459,7 @@ static int soc_camera_async_complete(struct v4l2_async_notifier *notifier)
} }
static int scan_async_group(struct soc_camera_host *ici, static int scan_async_group(struct soc_camera_host *ici,
struct v4l2_async_subdev **asd, int size) struct v4l2_async_subdev **asd, unsigned int size)
{ {
struct soc_camera_async_subdev *sasd; struct soc_camera_async_subdev *sasd;
struct soc_camera_async_client *sasc; struct soc_camera_async_client *sasc;
......
...@@ -23,7 +23,7 @@ struct sh_mobile_ceu_info { ...@@ -23,7 +23,7 @@ struct sh_mobile_ceu_info {
int max_height; int max_height;
struct sh_mobile_ceu_companion *csi2; struct sh_mobile_ceu_companion *csi2;
struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
int *asd_sizes; /* 0-terminated array pf asd group sizes */ unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */
}; };
#endif /* __ASM_SH_MOBILE_CEU_H__ */ #endif /* __ASM_SH_MOBILE_CEU_H__ */
...@@ -87,7 +87,7 @@ struct soc_camera_host { ...@@ -87,7 +87,7 @@ struct soc_camera_host {
const char *drv_name; const char *drv_name;
struct soc_camera_host_ops *ops; struct soc_camera_host_ops *ops;
struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
int *asd_sizes; /* 0-terminated array of asd group sizes */ unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */
}; };
struct soc_camera_host_ops { struct soc_camera_host_ops {
......
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