[linuxtv-media:master 465/495] drivers/staging/media/atomisp/pci/atomisp_v4l2.c:1193:3: warning: variable 'count' is incremented both in the loop header and in the loop body

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://linuxtv.org/media_tree.git master
head:   960b2dee908b0fc51cf670841de13b40b44aaaae
commit: 09d87466655d00526cf818b3f3b267884c591702 [465/495] media: atomisp: reduce the risk of a race condition
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project e6658079aca6d971b4e9d7137a3a2ecbc9c34aec)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        git checkout 09d87466655d00526cf818b3f3b267884c591702
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/staging/media/atomisp/pci/atomisp_v4l2.c:1193:3: warning: variable 'count' is incremented both in the loop header and in the loop body [-Wfor-loop-analysis]
count++;
^
drivers/staging/media/atomisp/pci/atomisp_v4l2.c:1189:57: note: incremented here
for (count = 0; count < SUBDEV_WAIT_TIMEOUT_MAX_COUNT; count++) {
^
1 warning generated.

vim +/count +1193 drivers/staging/media/atomisp/pci/atomisp_v4l2.c

  1084	
  1085	static int atomisp_subdev_probe(struct atomisp_device *isp)
  1086	{
  1087		const struct atomisp_platform_data *pdata;
  1088		struct intel_v4l2_subdev_table *subdevs;
  1089		int ret, raw_index = -1, count;
  1090	
  1091		pdata = atomisp_get_platform_data();
  1092		if (!pdata) {
  1093			dev_err(isp->dev, "no platform data available\n");
  1094			return 0;
  1095		}
  1096	
  1097		/* FIXME: should, instead, use I2C probe */
  1098	
  1099		for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) {
  1100			struct v4l2_subdev *subdev;
  1101			struct i2c_board_info *board_info =
  1102				    &subdevs->v4l2_subdev.board_info;
  1103			struct i2c_adapter *adapter =
  1104			    i2c_get_adapter(subdevs->v4l2_subdev.i2c_adapter_id);
  1105			int sensor_num, i;
  1106	
  1107			dev_info(isp->dev, "Probing Subdev %s\n", board_info->type);
  1108	
  1109			if (!adapter) {
  1110				dev_err(isp->dev,
  1111					"Failed to find i2c adapter for subdev %s\n",
  1112					board_info->type);
  1113				break;
  1114			}
  1115	
  1116			/* In G-Min, the sensor devices will already be probed
  1117			 * (via ACPI) and registered, do not create new
  1118			 * ones */
  1119			subdev = atomisp_gmin_find_subdev(adapter, board_info);
  1120			ret = v4l2_device_register_subdev(&isp->v4l2_dev, subdev);
  1121			if (ret) {
  1122				dev_warn(isp->dev, "Subdev %s detection fail\n",
  1123					 board_info->type);
  1124				continue;
  1125			}
  1126	
  1127			if (!subdev) {
  1128				dev_warn(isp->dev, "Subdev %s detection fail\n",
  1129					 board_info->type);
  1130				continue;
  1131			}
  1132	
  1133			dev_info(isp->dev, "Subdev %s successfully register\n",
  1134				 board_info->type);
  1135	
  1136			switch (subdevs->type) {
  1137			case RAW_CAMERA:
  1138				raw_index = isp->input_cnt;
  1139				dev_dbg(isp->dev, "raw_index: %d\n", raw_index);
  1140			case SOC_CAMERA:
  1141				dev_dbg(isp->dev, "SOC_INDEX: %d\n", isp->input_cnt);
  1142				if (isp->input_cnt >= ATOM_ISP_MAX_INPUTS) {
  1143					dev_warn(isp->dev,
  1144						 "too many atomisp inputs, ignored\n");
  1145					break;
  1146				}
  1147	
  1148				isp->inputs[isp->input_cnt].type = subdevs->type;
  1149				isp->inputs[isp->input_cnt].port = subdevs->port;
  1150				isp->inputs[isp->input_cnt].camera = subdev;
  1151				isp->inputs[isp->input_cnt].sensor_index = 0;
  1152				/*
  1153				 * initialize the subdev frame size, then next we can
  1154				 * judge whether frame_size store effective value via
  1155				 * pixel_format.
  1156				 */
  1157				isp->inputs[isp->input_cnt].frame_size.pixel_format = 0;
  1158				isp->inputs[isp->input_cnt].camera_caps =
  1159				    atomisp_get_default_camera_caps();
  1160				sensor_num = isp->inputs[isp->input_cnt]
  1161					     .camera_caps->sensor_num;
  1162				isp->input_cnt++;
  1163				for (i = 1; i < sensor_num; i++) {
  1164					if (isp->input_cnt >= ATOM_ISP_MAX_INPUTS) {
  1165						dev_warn(isp->dev,
  1166							 "atomisp inputs out of range\n");
  1167						break;
  1168					}
  1169					isp->inputs[isp->input_cnt] =
  1170					    isp->inputs[isp->input_cnt - 1];
  1171					isp->inputs[isp->input_cnt].sensor_index = i;
  1172					isp->input_cnt++;
  1173				}
  1174				break;
  1175			case CAMERA_MOTOR:
  1176				isp->motor = subdev;
  1177				break;
  1178			case LED_FLASH:
  1179			case XENON_FLASH:
  1180				isp->flash = subdev;
  1181				break;
  1182			default:
  1183				dev_dbg(isp->dev, "unknown subdev probed\n");
  1184				break;
  1185			}
  1186		}
  1187	
  1188		/* FIXME: should return -EPROBE_DEFER if not all subdevs were probed */
  1189		for (count = 0; count < SUBDEV_WAIT_TIMEOUT_MAX_COUNT; count++) {
  1190			if (isp->input_cnt)
  1191				break;
  1192			msleep(SUBDEV_WAIT_TIMEOUT);
> 1193			count++;
  1194		}
  1195		/* Wait more time to give more time for subdev init code */
  1196		msleep(5 * SUBDEV_WAIT_TIMEOUT);
  1197	
  1198		/*
  1199		 * HACK: Currently VCM belongs to primary sensor only, but correct
  1200		 * approach must be to acquire from platform code which sensor
  1201		 * owns it.
  1202		 */
  1203		if (isp->motor && raw_index >= 0)
  1204			isp->inputs[raw_index].motor = isp->motor;
  1205	
  1206		/* Proceed even if no modules detected. For COS mode and no modules. */
  1207		if (!isp->input_cnt)
  1208			dev_warn(isp->dev, "no camera attached or fail to detect\n");
  1209		else
  1210			dev_info(isp->dev, "detected %d camera sensors\n",
  1211				 isp->input_cnt);
  1212	
  1213		return atomisp_csi_lane_config(isp);
  1214	}
  1215	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux