diff options
author | Oliver Brown <oliver.brown@freescale.com> | 2013-11-22 11:30:15 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:47:23 -0400 |
commit | a4d562cd49ca1e72333eef7bacc1c5dd83ab0bad (patch) | |
tree | 6a4073f7143d8b9717d9c60657ca61ff3c095f83 /drivers/media | |
parent | 36274e40bc29283f334a0f953ca9e81f6f559561 (diff) |
ENGR00289436 - [V4L2 Capture] Build warning on mxc_v4l2_capture.c
Need to remove the following warning:
warning: array subscript is above array bounds
Summary of changes:
Moved MXC_SENSOR_NUM definition to mxc_v4l2_capture.h.
all_sensors[] now uses MXC_SENSOR_NUM in definition.
MXC_SENSOR_NUM is now used for bounds checking the array.
Signed-off-by: Oliver Brown <oliver.brown@freescale.com>
Diffstat (limited to 'drivers/media')
-rwxr-xr-x | drivers/media/platform/mxc/capture/mxc_v4l2_capture.c | 3 | ||||
-rw-r--r-- | drivers/media/platform/mxc/capture/mxc_v4l2_capture.h | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c index 22b90d3eb4b3..db64674e45c7 100755 --- a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include "ipu_prp_sw.h" | 44 | #include "ipu_prp_sw.h" |
45 | 45 | ||
46 | #define init_MUTEX(sem) sema_init(sem, 1) | 46 | #define init_MUTEX(sem) sema_init(sem, 1) |
47 | #define MXC_SENSOR_NUM 2 | ||
48 | 47 | ||
49 | static struct platform_device_id imx_v4l2_devtype[] = { | 48 | static struct platform_device_id imx_v4l2_devtype[] = { |
50 | { | 49 | { |
@@ -3055,7 +3054,7 @@ static void mxc_v4l2_master_detach(struct v4l2_int_device *slave) | |||
3055 | /* Move all the sensors behind this | 3054 | /* Move all the sensors behind this |
3056 | * sensor one step forward | 3055 | * sensor one step forward |
3057 | */ | 3056 | */ |
3058 | for (; i < cam->sensor_index - 1; i++) | 3057 | for (; i <= MXC_SENSOR_NUM - 2; i++) |
3059 | cam->all_sensors[i] = cam->all_sensors[i+1]; | 3058 | cam->all_sensors[i] = cam->all_sensors[i+1]; |
3060 | break; | 3059 | break; |
3061 | } | 3060 | } |
diff --git a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h index d18ad60d4813..09a421f20f7e 100644 --- a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h +++ b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.h | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | #define FRAME_NUM 10 | 43 | #define FRAME_NUM 10 |
44 | #define MXC_SENSOR_NUM 2 | ||
44 | 45 | ||
45 | enum imx_v4l2_devtype { | 46 | enum imx_v4l2_devtype { |
46 | IMX5_V4L2, | 47 | IMX5_V4L2, |
@@ -213,7 +214,7 @@ typedef struct _cam_data { | |||
213 | 214 | ||
214 | /* camera sensor interface */ | 215 | /* camera sensor interface */ |
215 | struct camera_sensor *cam_sensor; /* old version */ | 216 | struct camera_sensor *cam_sensor; /* old version */ |
216 | struct v4l2_int_device *all_sensors[2]; | 217 | struct v4l2_int_device *all_sensors[MXC_SENSOR_NUM]; |
217 | struct v4l2_int_device *sensor; | 218 | struct v4l2_int_device *sensor; |
218 | struct v4l2_int_device *self; | 219 | struct v4l2_int_device *self; |
219 | int sensor_index; | 220 | int sensor_index; |