summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-02-18 11:20:31 +0100
committerDavid S. Miller <davem@davemloft.net>2013-02-19 06:51:09 +0100
commit07dcf8e9cc77e86eedfc28fa37713b5471e906b7 (patch)
tree0bc1555b8ac4d8ff36bd6d036a39291a9c5a5f53 /drivers/net
parentip_gre: propogate target device GSO capability to the tunnel device (diff)
downloadlinux-07dcf8e9cc77e86eedfc28fa37713b5471e906b7.tar.xz
linux-07dcf8e9cc77e86eedfc28fa37713b5471e906b7.zip
net: fec: Do a sanity check on the gpio number
Check whether the phy-reset GPIO is valid, prior to requesting it. In the case a board does not provide a phy-reset GPIO, just returns immediately. With such gpio validation in place, it is also safe to change from pr_debug to dev_err in the case the gpio request fails. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/fec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 0fe68c46267e..29d82cf1528e 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1689,10 +1689,13 @@ static void fec_reset_phy(struct platform_device *pdev)
msec = 1;
phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
+ if (!gpio_is_valid(phy_reset))
+ return;
+
err = devm_gpio_request_one(&pdev->dev, phy_reset,
GPIOF_OUT_INIT_LOW, "phy-reset");
if (err) {
- pr_debug("FEC: failed to get gpio phy-reset: %d\n", err);
+ dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
return;
}
msleep(msec);