Re: [PATCH] gpu: ipu-v3: fix OF node reference leaks in ipu_add_client_devices()

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

 



Hi Joe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pza/reset/next]
[also build test WARNING on linus/master pza/imx-drm/next v6.13-rc4 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Joe-Hattori/gpu-ipu-v3-fix-OF-node-reference-leaks-in-ipu_add_client_devices/20241215-112258
base:   https://git.pengutronix.de/git/pza/linux reset/next
patch link:    https://lore.kernel.org/r/20241215032222.2507759-1-joe%40pf.is.s.u-tokyo.ac.jp
patch subject: [PATCH] gpu: ipu-v3: fix OF node reference leaks in ipu_add_client_devices()
config: powerpc-randconfig-r072-20241223 (https://download.01.org/0day-ci/archive/20241224/202412240257.hBU9oQRB-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 14.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412240257.hBU9oQRB-lkp@xxxxxxxxx/

smatch warnings:
drivers/gpu/ipu-v3/ipu-common.c:1189 ipu_add_client_devices() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
drivers/gpu/ipu-v3/ipu-common.c:1189 ipu_add_client_devices() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'

vim +1189 drivers/gpu/ipu-v3/ipu-common.c

  1138	
  1139	static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
  1140	{
  1141		struct device *dev = ipu->dev;
  1142		unsigned i;
  1143		int id, ret;
  1144	
  1145		mutex_lock(&ipu_client_id_mutex);
  1146		id = ipu_client_id;
  1147		ipu_client_id += ARRAY_SIZE(client_reg);
  1148		mutex_unlock(&ipu_client_id_mutex);
  1149	
  1150		for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
  1151			struct ipu_platform_reg *reg = &client_reg[i];
  1152			struct platform_device *pdev;
  1153			struct device_node *of_node;
  1154	
  1155			/* Associate subdevice with the corresponding port node */
  1156			of_node = of_graph_get_port_by_id(dev->of_node, i);
  1157			if (!of_node) {
  1158				dev_info(dev,
  1159					 "no port@%d node in %pOF, not using %s%d\n",
  1160					 i, dev->of_node,
  1161					 (i / 2) ? "DI" : "CSI", i % 2);
  1162				continue;
  1163			}
  1164	
  1165			pdev = platform_device_alloc(reg->name, id++);
  1166			if (!pdev) {
  1167				ret = -ENOMEM;
  1168				of_node_put(of_node);
  1169				goto err_register;
  1170			}
  1171	
  1172			pdev->dev.parent = dev;
  1173	
  1174			reg->pdata.of_node = of_node;
  1175			ret = platform_device_add_data(pdev, &reg->pdata,
  1176						       sizeof(reg->pdata));
  1177			if (!ret)
  1178				ret = platform_device_add(pdev);
  1179			if (ret) {
  1180				platform_device_put(pdev);
  1181				of_node_put(of_node);
  1182				goto err_register;
  1183			}
  1184		}
  1185	
  1186		return 0;
  1187	
  1188	err_register:
> 1189		while (--i >= 0)
  1190			of_node_put(client_reg[i].pdata.of_node);
  1191		platform_device_unregister_children(to_platform_device(dev));
  1192	
  1193		return ret;
  1194	}
  1195	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux