net: fec: defer probe if regulator is not ready
authorFugang Duan <fugang.duan@nxp.com>
Wed, 3 Jan 2018 02:39:30 +0000 (10:39 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Jan 2018 16:40:41 +0000 (11:40 -0500)
Defer probe if regulator is not ready. E.g. some regulator is fixed
regulator controlled by i2c expander gpio, the i2c device may be probed
after the driver, then it should handle the case of defer probe error.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 6a4fc2b35488664cc098bb2cb78912d8bcf300c6..19f198e22e1544a80c5970f55c47acb66993ee10 100644 (file)
@@ -3469,6 +3469,10 @@ fec_probe(struct platform_device *pdev)
                        goto failed_regulator;
                }
        } else {
+               if (PTR_ERR(fep->reg_phy) == -EPROBE_DEFER) {
+                       ret = -EPROBE_DEFER;
+                       goto failed_regulator;
+               }
                fep->reg_phy = NULL;
        }