]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00289436 - [V4L2 Capture] Build warning on mxc_v4l2_capture.c
authorOliver Brown <oliver.brown@freescale.com>
Fri, 22 Nov 2013 16:30:15 +0000 (10:30 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:45 +0000 (10:06 +0200)
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>
drivers/media/platform/mxc/capture/mxc_v4l2_capture.c
drivers/media/platform/mxc/capture/mxc_v4l2_capture.h

index 22b90d3eb4b348d55739e74e4f36829fd1e7807e..db64674e45c701b22000485824c2bc82dfe1cc08 100755 (executable)
@@ -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;
                }
index d18ad60d4813a7a80598f85e5f9625c100f30da7..09a421f20f7e220d8e0d7822e220c7e71ac32d62 100644 (file)
@@ -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;