[PATCH] PCI: al: Use devm_platform_ioremap_resource_byname

shao.mingyin@zte.com.cn posted 1 patch 1 day, 3 hours ago
drivers/pci/controller/dwc/pcie-al.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] PCI: al: Use devm_platform_ioremap_resource_byname
Posted by shao.mingyin@zte.com.cn 1 day, 3 hours ago
From: Xie Ludan <xie.ludan@zte.com.cn>

Introduce devm_platform_ioremap_resource_byname() to simplify
resource retrieval and mapping.This new function consolidates
platform_get_resource_byname() and devm_ioremap_resource() into a single
call, improving code readability and reducing API call overhead.

Signed-off-by: Xie Ludan <xie.ludan@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
 drivers/pci/controller/dwc/pcie-al.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-al.c b/drivers/pci/controller/dwc/pcie-al.c
index 643115f74092..f0613d442578 100644
--- a/drivers/pci/controller/dwc/pcie-al.c
+++ b/drivers/pci/controller/dwc/pcie-al.c
@@ -353,9 +353,7 @@ static int al_pcie_probe(struct platform_device *pdev)
 	}
 	al_pcie->ecam_size = resource_size(ecam_res);

-	controller_res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-						      "controller");
-	al_pcie->controller_base = devm_ioremap_resource(dev, controller_res);
+	al_pcie->controller_base = devm_platform_ioremap_resource_byname(pdev, "controller");
 	if (IS_ERR(al_pcie->controller_base)) {
 		dev_err(dev, "couldn't remap controller base %pR\n",
 			controller_res);
-- 
2.25.1
Re: [PATCH] PCI: al: Use devm_platform_ioremap_resource_byname
Posted by Krzysztof Kozlowski 5 hours ago
On 03/04/2025 09:48, shao.mingyin@zte.com.cn wrote:
> From: Xie Ludan <xie.ludan@zte.com.cn>
> 
> Introduce devm_platform_ioremap_resource_byname() to simplify
> resource retrieval and mapping.This new function consolidates
> platform_get_resource_byname() and devm_ioremap_resource() into a single
> call, improving code readability and reducing API call overhead.
> 
NAK


You do not understand that code and your automation is just terrible.
Stop sending these automated patches.

Best regards,
Krzysztof
Re: [PATCH] PCI: al: Use devm_platform_ioremap_resource_byname
Posted by kernel test robot 15 hours ago
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@intel.com/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@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/202504040353.k5kLpniy-lkp@intel.com/

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