summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Brown <oliver.brown@freescale.com>2013-11-22 10:30:15 -0600
committerOliver Brown <oliver.brown@freescale.com>2013-11-22 19:34:07 -0600
commitc54b9ec25a91782cc1b49fe5d2a438e66b3f3ef5 (patch)
treee17365b5b58d4d45437c663142930fd62928c11b
parent7eca811461dbb5fd7ef2d37377facbfff912e9be (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>
-rwxr-xr-xdrivers/media/platform/mxc/capture/mxc_v4l2_capture.c3
-rw-r--r--drivers/media/platform/mxc/capture/mxc_v4l2_capture.h3
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 @@
#include "ipu_prp_sw.h"
#define init_MUTEX(sem) sema_init(sem, 1)
-#define MXC_SENSOR_NUM 2
static struct platform_device_id imx_v4l2_devtype[] = {
{
@@ -3055,7 +3054,7 @@ static void mxc_v4l2_master_detach(struct v4l2_int_device *slave)
/* Move all the sensors behind this
* sensor one step forward
*/
- for (; i < cam->sensor_index - 1; i++)
+ for (; i <= MXC_SENSOR_NUM - 2; i++)
cam->all_sensors[i] = cam->all_sensors[i+1];
break;
}
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 @@
#define FRAME_NUM 10
+#define MXC_SENSOR_NUM 2
enum imx_v4l2_devtype {
IMX5_V4L2,
@@ -213,7 +214,7 @@ typedef struct _cam_data {
/* camera sensor interface */
struct camera_sensor *cam_sensor; /* old version */
- struct v4l2_int_device *all_sensors[2];
+ struct v4l2_int_device *all_sensors[MXC_SENSOR_NUM];
struct v4l2_int_device *sensor;
struct v4l2_int_device *self;
int sensor_index;