Re: [PATCH] PCI: al: Use devm_platform_ioremap_resource_byname

From: kernel test robot
Date: Thu Apr 03 2025 - 17:04:48 EST


Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.14 next-20250403]
[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/shao-mingyin-zte-com-cn/PCI-al-Use-devm_platform_ioremap_resource_byname/20250403-155111
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20250403154833001aNpIIRBQWEw67Oo8nChch%40zte.com.cn
patch subject: [PATCH] PCI: al: Use devm_platform_ioremap_resource_byname
config: s390-randconfig-002-20250404 (https://download.01.org/0day-ci/archive/20250404/202504040353.k5kLpniy-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250404/202504040353.k5kLpniy-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/202504040353.k5kLpniy-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/pci/controller/dwc/pcie-al.c:359:4: warning: variable 'controller_res' is uninitialized when used here [-Wuninitialized]
359 | controller_res);
| ^~~~~~~~~~~~~~
include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/pci/controller/dwc/pcie-al.c:330:33: note: initialize the variable 'controller_res' to silence this warning
330 | struct resource *controller_res;
| ^
| = NULL
1 warning generated.


vim +/controller_res +359 drivers/pci/controller/dwc/pcie-al.c

a8daea94754989 Jonathan Chocron 2019-09-12 326
a8daea94754989 Jonathan Chocron 2019-09-12 327 static int al_pcie_probe(struct platform_device *pdev)
a8daea94754989 Jonathan Chocron 2019-09-12 328 {
a8daea94754989 Jonathan Chocron 2019-09-12 329 struct device *dev = &pdev->dev;
a8daea94754989 Jonathan Chocron 2019-09-12 330 struct resource *controller_res;
a8daea94754989 Jonathan Chocron 2019-09-12 331 struct resource *ecam_res;
a8daea94754989 Jonathan Chocron 2019-09-12 332 struct al_pcie *al_pcie;
a8daea94754989 Jonathan Chocron 2019-09-12 333 struct dw_pcie *pci;
a8daea94754989 Jonathan Chocron 2019-09-12 334
a8daea94754989 Jonathan Chocron 2019-09-12 335 al_pcie = devm_kzalloc(dev, sizeof(*al_pcie), GFP_KERNEL);
a8daea94754989 Jonathan Chocron 2019-09-12 336 if (!al_pcie)
a8daea94754989 Jonathan Chocron 2019-09-12 337 return -ENOMEM;
a8daea94754989 Jonathan Chocron 2019-09-12 338
a8daea94754989 Jonathan Chocron 2019-09-12 339 pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
a8daea94754989 Jonathan Chocron 2019-09-12 340 if (!pci)
a8daea94754989 Jonathan Chocron 2019-09-12 341 return -ENOMEM;
a8daea94754989 Jonathan Chocron 2019-09-12 342
a8daea94754989 Jonathan Chocron 2019-09-12 343 pci->dev = dev;
60f5b73fa0f298 Rob Herring 2020-11-05 344 pci->pp.ops = &al_pcie_host_ops;
a8daea94754989 Jonathan Chocron 2019-09-12 345
a8daea94754989 Jonathan Chocron 2019-09-12 346 al_pcie->pci = pci;
a8daea94754989 Jonathan Chocron 2019-09-12 347 al_pcie->dev = dev;
a8daea94754989 Jonathan Chocron 2019-09-12 348
a8daea94754989 Jonathan Chocron 2019-09-12 349 ecam_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
a8daea94754989 Jonathan Chocron 2019-09-12 350 if (!ecam_res) {
a8daea94754989 Jonathan Chocron 2019-09-12 351 dev_err(dev, "couldn't find 'config' reg in DT\n");
a8daea94754989 Jonathan Chocron 2019-09-12 352 return -ENOENT;
a8daea94754989 Jonathan Chocron 2019-09-12 353 }
a8daea94754989 Jonathan Chocron 2019-09-12 354 al_pcie->ecam_size = resource_size(ecam_res);
a8daea94754989 Jonathan Chocron 2019-09-12 355
99f4e0afd9fbe4 Xie Ludan 2025-04-03 356 al_pcie->controller_base = devm_platform_ioremap_resource_byname(pdev, "controller");
a8daea94754989 Jonathan Chocron 2019-09-12 357 if (IS_ERR(al_pcie->controller_base)) {
a8daea94754989 Jonathan Chocron 2019-09-12 358 dev_err(dev, "couldn't remap controller base %pR\n",
a8daea94754989 Jonathan Chocron 2019-09-12 @359 controller_res);
a8daea94754989 Jonathan Chocron 2019-09-12 360 return PTR_ERR(al_pcie->controller_base);
a8daea94754989 Jonathan Chocron 2019-09-12 361 }
a8daea94754989 Jonathan Chocron 2019-09-12 362
a0fd361db8e508 Rob Herring 2020-11-05 363 dev_dbg(dev, "From DT: controller_base: %pR\n", controller_res);
a8daea94754989 Jonathan Chocron 2019-09-12 364
a8daea94754989 Jonathan Chocron 2019-09-12 365 platform_set_drvdata(pdev, al_pcie);
a8daea94754989 Jonathan Chocron 2019-09-12 366
60f5b73fa0f298 Rob Herring 2020-11-05 367 return dw_pcie_host_init(&pci->pp);
a8daea94754989 Jonathan Chocron 2019-09-12 368 }
a8daea94754989 Jonathan Chocron 2019-09-12 369

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