All of lore.kernel.org
 help / color / mirror / Atom feed
* [lubaolu-intel-iommu:iommufd-io-pgfault-delivery-v4 3/12] drivers/iommu/iommu.c:3501:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2024-04-03  0:18 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-04-03  0:18 UTC (permalink / raw)
  To: Baolu Lu; +Cc: oe-kbuild-all

tree:   https://github.com/LuBaolu/intel-iommu.git iommufd-io-pgfault-delivery-v4
head:   6fc25b16b714233cbcb75b7dd5ded49f35f11e54
commit: d5026804d865698bd727f615117eed7f231b25a6 [3/12] iommu: Introduce domain attachment handle
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240403/202404030811.d15pFYS5-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 546dc2245ffc4cccd0b05b58b7a5955e355a3b27)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240403/202404030811.d15pFYS5-lkp@intel.com/reproduce)

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404030811.d15pFYS5-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/iommu/iommu.c:9:
   In file included from include/linux/amba/bus.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     509 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     516 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     528 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     537 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iommu/iommu.c:3501:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    3501 |         if (IS_ERR(handle))
         |             ^~~~~~~~~~~~~~
   drivers/iommu/iommu.c:3516:9: note: uninitialized use occurs here
    3516 |         return ret;
         |                ^~~
   drivers/iommu/iommu.c:3501:2: note: remove the 'if' if its condition is always false
    3501 |         if (IS_ERR(handle))
         |         ^~~~~~~~~~~~~~~~~~~
    3502 |                 goto out_unlock;
         |                 ~~~~~~~~~~~~~~~
   drivers/iommu/iommu.c:3480:9: note: initialize the variable 'ret' to silence this warning
    3480 |         int ret;
         |                ^
         |                 = 0
   6 warnings generated.


vim +3501 drivers/iommu/iommu.c

  3464	
  3465	/*
  3466	 * iommu_attach_device_pasid() - Attach a domain to pasid of device
  3467	 * @domain: the iommu domain.
  3468	 * @dev: the attached device.
  3469	 * @pasid: the pasid of the device.
  3470	 *
  3471	 * Return: 0 on success, or an error.
  3472	 */
  3473	int iommu_attach_device_pasid(struct iommu_domain *domain,
  3474				      struct device *dev, ioasid_t pasid)
  3475	{
  3476		/* Caller must be a probed driver on dev */
  3477		struct iommu_group *group = dev->iommu_group;
  3478		struct iommu_attach_handle *handle;
  3479		struct group_device *device;
  3480		int ret;
  3481	
  3482		if (!domain->ops->set_dev_pasid)
  3483			return -EOPNOTSUPP;
  3484	
  3485		if (!group)
  3486			return -ENODEV;
  3487	
  3488		if (!dev_has_iommu(dev) || dev_iommu_ops(dev) != domain->owner ||
  3489		    pasid == IOMMU_NO_PASID)
  3490			return -EINVAL;
  3491	
  3492		mutex_lock(&group->mutex);
  3493		for_each_group_device(group, device) {
  3494			if (pasid >= device->dev->iommu->max_pasids) {
  3495				ret = -EINVAL;
  3496				goto out_unlock;
  3497			}
  3498		}
  3499	
  3500		handle = iommu_attach_handle_set(domain, group, pasid);
> 3501		if (IS_ERR(handle))
  3502			goto out_unlock;
  3503	
  3504		ret = __iommu_set_group_pasid(domain, group, pasid);
  3505		if (ret)
  3506			goto out_put_handle;
  3507		mutex_unlock(&group->mutex);
  3508	
  3509		return 0;
  3510	
  3511	out_put_handle:
  3512		__iommu_remove_group_pasid(group, pasid);
  3513		iommu_attach_handle_put(handle);
  3514	out_unlock:
  3515		mutex_unlock(&group->mutex);
  3516		return ret;
  3517	}
  3518	EXPORT_SYMBOL_GPL(iommu_attach_device_pasid);
  3519	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-03  0:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03  0:18 [lubaolu-intel-iommu:iommufd-io-pgfault-delivery-v4 3/12] drivers/iommu/iommu.c:3501:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.