[5/5] PCI: uniphier: Add error message when failed to get phy
diff mbox series

Message ID 1589518105-18368-6-git-send-email-hayashi.kunihiko@socionext.com
State Superseded
Headers show
Series
  • PCI: uniphier: Add features for UniPhier PCIe host controller
Related show

Commit Message

Kunihiko Hayashi May 15, 2020, 4:48 a.m. UTC
Even if phy driver doesn't probe, the error message can't be
distinguished from other errors. This displays error message
caused by the phy driver explicitly.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/pci/controller/dwc/pcie-uniphier.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

kernel test robot May 15, 2020, 6:51 a.m. UTC | #1
Hi Kunihiko,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pci/next]
[also build test WARNING on robh/for-next v5.7-rc5 next-20200514]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Kunihiko-Hayashi/PCI-uniphier-Add-features-for-UniPhier-PCIe-host-controller/20200515-125031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/device.h:15:0,
from include/linux/pci.h:37,
from drivers/pci/controller/dwc/pcie-uniphier.c:18:
drivers/pci/controller/dwc/pcie-uniphier.c: In function 'uniphier_pcie_probe':
>> drivers/pci/controller/dwc/pcie-uniphier.c:470:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
dev_err(dev, "Failed to get phy (%d)n", PTR_ERR(priv->phy));
^
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
#define dev_fmt(fmt) fmt
^~~
>> drivers/pci/controller/dwc/pcie-uniphier.c:470:3: note: in expansion of macro 'dev_err'
dev_err(dev, "Failed to get phy (%d)n", PTR_ERR(priv->phy));
^~~~~~~

vim +470 drivers/pci/controller/dwc/pcie-uniphier.c

   430	
   431	static int uniphier_pcie_probe(struct platform_device *pdev)
   432	{
   433		struct device *dev = &pdev->dev;
   434		struct uniphier_pcie_priv *priv;
   435		struct resource *res;
   436		int ret;
   437	
   438		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
   439		if (!priv)
   440			return -ENOMEM;
   441	
   442		priv->pci.dev = dev;
   443		priv->pci.ops = &dw_pcie_ops;
   444	
   445		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
   446		priv->pci.dbi_base = devm_pci_remap_cfg_resource(dev, res);
   447		if (IS_ERR(priv->pci.dbi_base))
   448			return PTR_ERR(priv->pci.dbi_base);
   449	
   450		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
   451		priv->pci.atu_base = devm_pci_remap_cfg_resource(dev, res);
   452		if (IS_ERR(priv->pci.atu_base))
   453			priv->pci.atu_base = NULL;
   454	
   455		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "link");
   456		priv->base = devm_ioremap_resource(dev, res);
   457		if (IS_ERR(priv->base))
   458			return PTR_ERR(priv->base);
   459	
   460		priv->clk = devm_clk_get(dev, NULL);
   461		if (IS_ERR(priv->clk))
   462			return PTR_ERR(priv->clk);
   463	
   464		priv->rst = devm_reset_control_get_shared(dev, NULL);
   465		if (IS_ERR(priv->rst))
   466			return PTR_ERR(priv->rst);
   467	
   468		priv->phy = devm_phy_optional_get(dev, "pcie-phy");
   469		if (IS_ERR(priv->phy)) {
 > 470			dev_err(dev, "Failed to get phy (%d)\n", PTR_ERR(priv->phy));
   471			return PTR_ERR(priv->phy);
   472		}
   473	
   474		platform_set_drvdata(pdev, priv);
   475	
   476		ret = uniphier_pcie_host_enable(priv);
   477		if (ret)
   478			return ret;
   479	
   480		return uniphier_add_pcie_port(priv, pdev);
   481	}
   482	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Kunihiko Hayashi May 15, 2020, 9:28 a.m. UTC | #2
On 2020/05/15 15:51, kbuild test robot wrote:
> Hi Kunihiko,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on pci/next]
> [also build test WARNING on robh/for-next v5.7-rc5 next-20200514]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Kunihiko-Hayashi/PCI-uniphier-Add-features-for-UniPhier-PCIe-host-controller/20200515-125031
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: i386-allyesconfig (attached as .config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=i386
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> In file included from include/linux/device.h:15:0,
> from include/linux/pci.h:37,
> from drivers/pci/controller/dwc/pcie-uniphier.c:18:
> drivers/pci/controller/dwc/pcie-uniphier.c: In function 'uniphier_pcie_probe':
>>> drivers/pci/controller/dwc/pcie-uniphier.c:470:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
> dev_err(dev, "Failed to get phy (%d)n", PTR_ERR(priv->phy));
> ^
> include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
> #define dev_fmt(fmt) fmt
> ^~~
>>> drivers/pci/controller/dwc/pcie-uniphier.c:470:3: note: in expansion of macro 'dev_err'
> dev_err(dev, "Failed to get phy (%d)n", PTR_ERR(priv->phy));
> ^~~~~~~

This should be fixed. I'll fix it in v2.

Thanks,

---
Best Regards
Kunihiko Hayashi

Patch
diff mbox series

diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
index 6180d50..2bcf394 100644
--- a/drivers/pci/controller/dwc/pcie-uniphier.c
+++ b/drivers/pci/controller/dwc/pcie-uniphier.c
@@ -480,8 +480,10 @@  static int uniphier_pcie_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->rst);
 
 	priv->phy = devm_phy_optional_get(dev, "pcie-phy");
-	if (IS_ERR(priv->phy))
+	if (IS_ERR(priv->phy)) {
+		dev_err(dev, "Failed to get phy (%d)\n", PTR_ERR(priv->phy));
 		return PTR_ERR(priv->phy);
+	}
 
 	platform_set_drvdata(pdev, priv);