Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: mxc: add check to return defer probe if clock tree NOT ready

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>

authored by

Anson Huang and committed by
Linus Walleij
a329bbe7 af39459b

+4 -1
+4 -1
drivers/gpio/gpio-mxc.c
··· 438 438 439 439 /* the controller clock is optional */ 440 440 port->clk = devm_clk_get(&pdev->dev, NULL); 441 - if (IS_ERR(port->clk)) 441 + if (IS_ERR(port->clk)) { 442 + if (PTR_ERR(port->clk) == -EPROBE_DEFER) 443 + return -EPROBE_DEFER; 442 444 port->clk = NULL; 445 + } 443 446 444 447 err = clk_prepare_enable(port->clk); 445 448 if (err) {