diff mbox

pci: ftpci100: Make clocks compulsory

Message ID 20170621083228.30631-1-linus.walleij@linaro.org (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Linus Walleij June 21, 2017, 8:32 a.m. UTC
This fixes a regression on the FTPCI100 PCI driver.

When the clock controller was augmented to probe clocks
from the platform device except to the most basic clocks
pertaining to timers, clocks may return an error pointer
containing -EPROBE_DEFER.

This hit the PCI driver which would try to continue
without the clocks, but the actual clocks appeared later,
so we did not pick them up properly, and in the end of
the boot, these clocks get gated off if no users register,
so the PCI host became numbed off and silently nonworking.

The clocks for this PCI bus are defined properly for all
platforms implementing it, so we should make them compulsory
before new users arrive so we have our resources under
control.

This makes the driver bail out of probe with any error
code from the clock, including -EPROBE_DEFER so that we
again have a clean boot.

Fixes: cea186ac1e45 ("pci: ftpci100: Add clock handling")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/pci/host/pci-ftpci100.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

Comments

kernel test robot June 22, 2017, 11:23 a.m. UTC | #1
Hi Linus,

[auto build test WARNING on pci/next]
[also build test WARNING on next-20170622]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Linus-Walleij/pci-ftpci100-Make-clocks-compulsory/20170622-171211
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/pci/host/pci-ftpci100.c: In function 'faraday_pci_probe':
>> drivers/pci/host/pci-ftpci100.c:456:18: warning: passing argument 1 of 'ERR_PTR' makes integer from pointer without a cast [-Wint-conversion]
      return ERR_PTR(clk);
                     ^~~
   In file included from include/linux/io.h:24:0,
                    from drivers/pci/host/pci-ftpci100.c:15:
   include/linux/err.h:23:35: note: expected 'long int' but argument is of type 'struct clk *'
    static inline void * __must_check ERR_PTR(long error)
                                      ^~~~~~~
>> drivers/pci/host/pci-ftpci100.c:456:10: warning: return makes integer from pointer without a cast [-Wint-conversion]
      return ERR_PTR(clk);
             ^~~~~~~~~~~~
   drivers/pci/host/pci-ftpci100.c:464:18: warning: passing argument 1 of 'ERR_PTR' makes integer from pointer without a cast [-Wint-conversion]
      return ERR_PTR(clk);
                     ^~~
   In file included from include/linux/io.h:24:0,
                    from drivers/pci/host/pci-ftpci100.c:15:
   include/linux/err.h:23:35: note: expected 'long int' but argument is of type 'struct clk *'
    static inline void * __must_check ERR_PTR(long error)
                                      ^~~~~~~
   drivers/pci/host/pci-ftpci100.c:464:10: warning: return makes integer from pointer without a cast [-Wint-conversion]
      return ERR_PTR(clk);
             ^~~~~~~~~~~~

vim +/ERR_PTR +456 drivers/pci/host/pci-ftpci100.c

   440	
   441		host = pci_alloc_host_bridge(sizeof(*p));
   442		if (!host)
   443			return -ENOMEM;
   444	
   445		host->dev.parent = dev;
   446		host->ops = &faraday_pci_ops;
   447		host->busnr = 0;
   448		host->msi = NULL;
   449		p = pci_host_bridge_priv(host);
   450		host->sysdata = p;
   451		p->dev = dev;
   452	
   453		/* Retrieve and enable optional clocks */
   454		clk = devm_clk_get(dev, "PCLK");
   455		if (IS_ERR(clk))
 > 456			return ERR_PTR(clk);
   457		ret = clk_prepare_enable(clk);
   458		if (ret) {
   459			dev_err(dev, "could not prepare PCLK\n");
   460			return ret;
   461		}
   462		p->bus_clk = devm_clk_get(dev, "PCICLK");
   463		if (IS_ERR(p->bus_clk))
   464			return ERR_PTR(clk);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
index d3bf153a2ab2..da62224e8e04 100644
--- a/drivers/pci/host/pci-ftpci100.c
+++ b/drivers/pci/host/pci-ftpci100.c
@@ -463,24 +463,20 @@  static int faraday_pci_probe(struct platform_device *pdev)
 
 	/* Retrieve and enable optional clocks */
 	clk = devm_clk_get(dev, "PCLK");
-	if (IS_ERR(clk)) {
-		dev_err(dev, "no PCLK available\n");
-	} else {
-		ret = clk_prepare_enable(clk);
-		if (ret) {
-			dev_err(dev, "could not prepare PCLK\n");
-			return ret;
-		}
+	if (IS_ERR(clk))
+		return ERR_PTR(clk);
+	ret = clk_prepare_enable(clk);
+	if (ret) {
+		dev_err(dev, "could not prepare PCLK\n");
+		return ret;
 	}
 	p->bus_clk = devm_clk_get(dev, "PCICLK");
-	if (IS_ERR(p->bus_clk)) {
-		dev_err(dev, "no PCICLK available\n");
-	} else {
-		ret = clk_prepare_enable(p->bus_clk);
-		if (ret) {
-			dev_err(dev, "could not prepare PCICLK\n");
-			return ret;
-		}
+	if (IS_ERR(p->bus_clk))
+		return ERR_PTR(clk);
+	ret = clk_prepare_enable(p->bus_clk);
+	if (ret) {
+		dev_err(dev, "could not prepare PCICLK\n");
+		return ret;
 	}
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);