summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnson Huang <anson.huang@nxp.com>2019-02-23 03:18:25 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-08 07:22:58 +0200
commita3769982eceeb4a0ff4970210c6cdb55252e28fb (patch)
treefec5d60109020de317ef4b15403ebc942521ca77
parent92cd6ae804615d0f415191319315ca6bbf4651d6 (diff)
downloadlinux-stable-a3769982eceeb4a0ff4970210c6cdb55252e28fb.tar.gz
linux-stable-a3769982eceeb4a0ff4970210c6cdb55252e28fb.tar.bz2
linux-stable-a3769982eceeb4a0ff4970210c6cdb55252e28fb.zip
gpio: mxc: add check to return defer probe if clock tree NOT ready
commit a329bbe707cee2cf8c660890ef2ad0d00ec7e8a3 upstream. On i.MX8MQ platform, clock driver uses platform driver model and it is probed after GPIO driver, so when GPIO driver fails to get clock, it should check the error type to decide whether to return defer probe or just ignore the clock operation. Fixes: 2808801aab8a ("gpio: mxc: add clock operation") Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpio/gpio-mxc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 2d1dfa1e0745..e86e61dda4b7 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -438,8 +438,11 @@ static int mxc_gpio_probe(struct platform_device *pdev)
/* the controller clock is optional */
port->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(port->clk))
+ if (IS_ERR(port->clk)) {
+ if (PTR_ERR(port->clk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
port->clk = NULL;
+ }
err = clk_prepare_enable(port->clk);
if (err) {