* [yiliu1765-iommufd:wip/iommufd_pasid-20240325 14/26] drivers/iommu/iommufd/pasid.c:37 iommufd_device_pasid_do_attach() warn: passing zero to 'ERR_PTR'
@ 2024-03-26 12:58 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-03-26 12:58 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Yi Liu <yi.l.liu@intel.com>
TO: Kevin Tian <kevin.tian@intel.com>
tree: https://github.com/yiliu1765/iommufd.git wip/iommufd_pasid-20240325
head: 7bb9cc1c3a745ec3330323eebdf73f9a9e87376e
commit: d14d15b07135ca14f5008f865b371fc7a1aef36d [14/26] iommufd: Support attach/replace hwpt per pasid
:::::: branch date: 24 hours ago
:::::: commit date: 27 hours ago
config: i386-randconfig-141-20240326 (https://download.01.org/0day-ci/archive/20240326/202403262020.otycu3fa-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202403262020.otycu3fa-lkp@intel.com/
smatch warnings:
drivers/iommu/iommufd/pasid.c:37 iommufd_device_pasid_do_attach() warn: passing zero to 'ERR_PTR'
drivers/iommu/iommufd/pasid.c:74 iommufd_device_pasid_do_replace() warn: passing zero to 'ERR_PTR'
vim +/ERR_PTR +37 drivers/iommu/iommufd/pasid.c
d14d15b07135ca Yi Liu 2024-03-18 9
d14d15b07135ca Yi Liu 2024-03-18 10 struct iommufd_hw_pagetable *
d14d15b07135ca Yi Liu 2024-03-18 11 iommufd_device_pasid_do_attach(struct iommufd_device *idev, u32 pasid,
d14d15b07135ca Yi Liu 2024-03-18 12 struct iommufd_hw_pagetable *hwpt)
d14d15b07135ca Yi Liu 2024-03-18 13 {
d14d15b07135ca Yi Liu 2024-03-18 14 void *curr;
d14d15b07135ca Yi Liu 2024-03-18 15 int rc;
d14d15b07135ca Yi Liu 2024-03-18 16
d14d15b07135ca Yi Liu 2024-03-18 17 refcount_inc(&hwpt->obj.users);
d14d15b07135ca Yi Liu 2024-03-18 18 curr = xa_cmpxchg(&idev->pasid_hwpts, pasid, NULL, hwpt, GFP_KERNEL);
d14d15b07135ca Yi Liu 2024-03-18 19 if (curr) {
d14d15b07135ca Yi Liu 2024-03-18 20 if (curr == hwpt)
d14d15b07135ca Yi Liu 2024-03-18 21 rc = 0;
d14d15b07135ca Yi Liu 2024-03-18 22 else
d14d15b07135ca Yi Liu 2024-03-18 23 rc = xa_err(curr) ? : -EBUSY;
d14d15b07135ca Yi Liu 2024-03-18 24 goto err_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 25 }
d14d15b07135ca Yi Liu 2024-03-18 26
d14d15b07135ca Yi Liu 2024-03-18 27 rc = iommu_attach_device_pasid(hwpt->domain, idev->dev, pasid);
d14d15b07135ca Yi Liu 2024-03-18 28 if (rc) {
d14d15b07135ca Yi Liu 2024-03-18 29 xa_erase(&idev->pasid_hwpts, pasid);
d14d15b07135ca Yi Liu 2024-03-18 30 goto err_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 31 }
d14d15b07135ca Yi Liu 2024-03-18 32
d14d15b07135ca Yi Liu 2024-03-18 33 return NULL;
d14d15b07135ca Yi Liu 2024-03-18 34
d14d15b07135ca Yi Liu 2024-03-18 35 err_put_hwpt:
d14d15b07135ca Yi Liu 2024-03-18 36 refcount_dec(&hwpt->obj.users);
d14d15b07135ca Yi Liu 2024-03-18 @37 return ERR_PTR(rc);
d14d15b07135ca Yi Liu 2024-03-18 38 }
d14d15b07135ca Yi Liu 2024-03-18 39
d14d15b07135ca Yi Liu 2024-03-18 40 struct iommufd_hw_pagetable *
d14d15b07135ca Yi Liu 2024-03-18 41 iommufd_device_pasid_do_replace(struct iommufd_device *idev, u32 pasid,
d14d15b07135ca Yi Liu 2024-03-18 42 struct iommufd_hw_pagetable *hwpt)
d14d15b07135ca Yi Liu 2024-03-18 43 {
d14d15b07135ca Yi Liu 2024-03-18 44 void *curr;
d14d15b07135ca Yi Liu 2024-03-18 45 int rc;
d14d15b07135ca Yi Liu 2024-03-18 46
d14d15b07135ca Yi Liu 2024-03-18 47 refcount_inc(&hwpt->obj.users);
d14d15b07135ca Yi Liu 2024-03-18 48 curr = xa_store(&idev->pasid_hwpts, pasid, hwpt, GFP_KERNEL);
d14d15b07135ca Yi Liu 2024-03-18 49 rc = xa_err(curr);
d14d15b07135ca Yi Liu 2024-03-18 50 if (rc)
d14d15b07135ca Yi Liu 2024-03-18 51 goto out_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 52
d14d15b07135ca Yi Liu 2024-03-18 53 if (!curr) {
d14d15b07135ca Yi Liu 2024-03-18 54 xa_erase(&idev->pasid_hwpts, pasid);
d14d15b07135ca Yi Liu 2024-03-18 55 rc = -EINVAL;
d14d15b07135ca Yi Liu 2024-03-18 56 goto out_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 57 }
d14d15b07135ca Yi Liu 2024-03-18 58
d14d15b07135ca Yi Liu 2024-03-18 59 if (curr == hwpt)
d14d15b07135ca Yi Liu 2024-03-18 60 goto out_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 61
d14d15b07135ca Yi Liu 2024-03-18 62 rc = iommu_replace_device_pasid(hwpt->domain, idev->dev, pasid);
d14d15b07135ca Yi Liu 2024-03-18 63 if (rc) {
d14d15b07135ca Yi Liu 2024-03-18 64 WARN_ON(xa_err(xa_store(&idev->pasid_hwpts, pasid,
d14d15b07135ca Yi Liu 2024-03-18 65 curr, GFP_KERNEL)));
d14d15b07135ca Yi Liu 2024-03-18 66 goto out_put_hwpt;
d14d15b07135ca Yi Liu 2024-03-18 67 }
d14d15b07135ca Yi Liu 2024-03-18 68
d14d15b07135ca Yi Liu 2024-03-18 69 /* Caller must destroy old_hwpt */
d14d15b07135ca Yi Liu 2024-03-18 70 return curr;
d14d15b07135ca Yi Liu 2024-03-18 71
d14d15b07135ca Yi Liu 2024-03-18 72 out_put_hwpt:
d14d15b07135ca Yi Liu 2024-03-18 73 refcount_dec(&hwpt->obj.users);
d14d15b07135ca Yi Liu 2024-03-18 @74 return ERR_PTR(rc);
d14d15b07135ca Yi Liu 2024-03-18 75 }
d14d15b07135ca Yi Liu 2024-03-18 76
--
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-03-26 12:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-26 12:58 [yiliu1765-iommufd:wip/iommufd_pasid-20240325 14/26] drivers/iommu/iommufd/pasid.c:37 iommufd_device_pasid_do_attach() warn: passing zero to 'ERR_PTR' 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.