Re: [PATCH v3 2/5] iommu/amd: Introduce helper functions to access and update 256-bit DTE

From: kernel test robot
Date: Sat Sep 07 2024 - 09:37:55 EST


Hi Suravee,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on joro-iommu/next v6.11-rc6 next-20240906]
[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/Suravee-Suthikulpanit/iommu-amd-Disable-AMD-IOMMU-if-CMPXCHG16B-feature-is-not-supported/20240906-201533
base: linus/master
patch link: https://lore.kernel.org/r/20240906121308.5013-3-suravee.suthikulpanit%40amd.com
patch subject: [PATCH v3 2/5] iommu/amd: Introduce helper functions to access and update 256-bit DTE
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240907/202409072100.WaB846Yg-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240907/202409072100.WaB846Yg-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409072100.WaB846Yg-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/iommu/amd/iommu.c:299:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
299 | if (!alias_data) {
| ^~~~~~~~~~~
drivers/iommu/amd/iommu.c:309:9: note: uninitialized use occurs here
309 | return ret;
| ^~~
drivers/iommu/amd/iommu.c:299:2: note: remove the 'if' if its condition is always true
299 | if (!alias_data) {
| ^~~~~~~~~~~~~~~~
drivers/iommu/amd/iommu.c:279:9: note: initialize the variable 'ret' to silence this warning
279 | int ret;
| ^
| = 0
1 warning generated.


vim +299 drivers/iommu/amd/iommu.c

272
273 static int clone_alias(struct pci_dev *pdev, u16 alias, void *data)
274 {
275 struct dev_table_entry dte;
276 struct amd_iommu *iommu;
277 struct iommu_dev_data *dev_data, *alias_data;
278 u16 devid = pci_dev_id(pdev);
279 int ret;
280
281 if (devid == alias)
282 return 0;
283
284 iommu = rlookup_amd_iommu(&pdev->dev);
285 if (!iommu)
286 return 0;
287
288 /* Get DTE for pdev */
289 dev_data = dev_iommu_priv_get(&pdev->dev);
290 if (!dev_data)
291 return -EINVAL;
292
293 spin_lock(&dev_data->dte_lock);
294 get_dte256(iommu, dev_data, &dte);
295 spin_unlock(&dev_data->dte_lock);
296
297 /* Setup for alias */
298 alias_data = search_dev_data(iommu, alias);
> 299 if (!alias_data) {
300 ret = -EINVAL;
301 goto out;
302 }
303
304 spin_lock(&alias_data->dte_lock);
305 update_dte256(iommu, alias_data, &dte);
306 amd_iommu_set_rlookup_table(iommu, alias);
307 spin_unlock(&alias_data->dte_lock);
308 out:
309 return ret;
310 }
311

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