There is no need to call the dev_err() function directly to print a
custom message when handling an error from either the platform_get_irq()
or platform_get_irq_byname() functions as both are going to display an
appropriate error message in case of a failure.
Eliminate the following warning:
./drivers/pci/endpoint/functions/pci-epf-mhi.c:362:2-9: line 362 is redundant because platform_get_irq_byname() already prints an error
Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5449
Signed-off-by: Yang Li <[email protected]>
---
drivers/pci/endpoint/functions/pci-epf-mhi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
index 1227f059ea12..371d6f80845e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
+++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
@@ -359,7 +359,6 @@ static int pci_epf_mhi_bind(struct pci_epf *epf)
ret = platform_get_irq_byname(pdev, "doorbell");
if (ret < 0) {
- dev_err(dev, "Failed to get Doorbell IRQ\n");
iounmap(epf_mhi->mmio);
return ret;
}
--
2.20.1.7.g153144c
Hi Yang,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20230607]
url: https://github.com/intel-lab-lkp/linux/commits/Yang-Li/PCI-endpoint-Remove-redundant-dev_err/20230607-173708
base: next-20230607
patch link: https://lore.kernel.org/r/20230607093514.104012-1-yang.lee%40linux.alibaba.com
patch subject: [PATCH -next] PCI: endpoint: Remove redundant dev_err().
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230608/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
git checkout next-20230607
b4 shazam https://lore.kernel.org/r/[email protected]
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/pci/endpoint/functions/
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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
drivers/pci/endpoint/functions/pci-epf-mhi.c: In function 'pci_epf_mhi_bind':
>> drivers/pci/endpoint/functions/pci-epf-mhi.c:347:24: warning: unused variable 'dev' [-Wunused-variable]
347 | struct device *dev = &epf->dev;
| ^~~
vim +/dev +347 drivers/pci/endpoint/functions/pci-epf-mhi.c
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 341
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 342 static int pci_epf_mhi_bind(struct pci_epf *epf)
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 343 {
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 344 struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 345 struct pci_epc *epc = epf->epc;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 346 struct platform_device *pdev = to_platform_device(epc->dev.parent);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 @347 struct device *dev = &epf->dev;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 348 struct resource *res;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 349 int ret;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 350
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 351 /* Get MMIO base address from Endpoint controller */
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 352 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mmio");
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 353 epf_mhi->mmio_phys = res->start;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 354 epf_mhi->mmio_size = resource_size(res);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 355
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 356 epf_mhi->mmio = ioremap(epf_mhi->mmio_phys, epf_mhi->mmio_size);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 357 if (IS_ERR(epf_mhi->mmio))
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 358 return PTR_ERR(epf_mhi->mmio);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 359
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 360 ret = platform_get_irq_byname(pdev, "doorbell");
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 361 if (ret < 0) {
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 362 iounmap(epf_mhi->mmio);
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 363 return ret;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 364 }
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 365
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 366 epf_mhi->irq = ret;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 367
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 368 return 0;
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 369 }
7db424a84d96b0 Manivannan Sadhasivam 2023-06-02 370
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hello,
> There is no need to call the dev_err() function directly to print a
> custom message when handling an error from either the platform_get_irq()
> or platform_get_irq_byname() functions as both are going to display an
> appropriate error message in case of a failure.
This extra dev_err() appears to have since been removed, per:
https://git.kernel.org/pci/pci/c/1bf5f25324f7
Nevertheless, thank you for sending the patch over!
Krzysztof