Merge "msm: camera: add error check in gc0339 config function"
diff --git a/drivers/media/platform/msm/camera_v2/sensor/gc0339.c b/drivers/media/platform/msm/camera_v2/sensor/gc0339.c
index 8cba04c..cc38b56 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/gc0339.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/gc0339.c
@@ -490,6 +490,11 @@
 			break;
 		}
 
+		if (conf_array.addr_type == MSM_CAMERA_I2C_WORD_ADDR
+			|| conf_array.data_type == MSM_CAMERA_I2C_WORD_DATA
+			|| !conf_array.size)
+			break;
+
 		reg_setting = kzalloc(conf_array.size *
 			(sizeof(struct msm_camera_i2c_reg_array)), GFP_KERNEL);
 		if (!reg_setting) {