diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-01-13 15:53:40 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-02-15 03:26:28 -0500 |
commit | 04e5216d44e173fab619d03e2f746f444ea21ebd (patch) | |
tree | ea55a76a411363d1db9b56d87554574bc7fae58f /drivers/net/fec.c | |
parent | b2b09ad63cc09448e49f6a4addae6e078c0e5e36 (diff) |
net/fec: no need to check for validity of ndev in suspend and resume
dev_set_drvdata is called unconditionally in the probe function and so
it cannot be NULL.
Reported-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r-- | drivers/net/fec.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index aa1db8e637cd..8026a16f6b6c 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -1492,16 +1492,14 @@ static int | |||
1492 | fec_suspend(struct device *dev) | 1492 | fec_suspend(struct device *dev) |
1493 | { | 1493 | { |
1494 | struct net_device *ndev = dev_get_drvdata(dev); | 1494 | struct net_device *ndev = dev_get_drvdata(dev); |
1495 | struct fec_enet_private *fep; | 1495 | struct fec_enet_private *fep = netdev_priv(ndev); |
1496 | 1496 | ||
1497 | if (ndev) { | 1497 | if (netif_running(ndev)) { |
1498 | fep = netdev_priv(ndev); | 1498 | fec_stop(ndev); |
1499 | if (netif_running(ndev)) { | 1499 | netif_device_detach(ndev); |
1500 | fec_stop(ndev); | ||
1501 | netif_device_detach(ndev); | ||
1502 | } | ||
1503 | clk_disable(fep->clk); | ||
1504 | } | 1500 | } |
1501 | clk_disable(fep->clk); | ||
1502 | |||
1505 | return 0; | 1503 | return 0; |
1506 | } | 1504 | } |
1507 | 1505 | ||
@@ -1509,16 +1507,14 @@ static int | |||
1509 | fec_resume(struct device *dev) | 1507 | fec_resume(struct device *dev) |
1510 | { | 1508 | { |
1511 | struct net_device *ndev = dev_get_drvdata(dev); | 1509 | struct net_device *ndev = dev_get_drvdata(dev); |
1512 | struct fec_enet_private *fep; | 1510 | struct fec_enet_private *fep = netdev_priv(ndev); |
1513 | 1511 | ||
1514 | if (ndev) { | 1512 | clk_enable(fep->clk); |
1515 | fep = netdev_priv(ndev); | 1513 | if (netif_running(ndev)) { |
1516 | clk_enable(fep->clk); | 1514 | fec_restart(ndev, fep->full_duplex); |
1517 | if (netif_running(ndev)) { | 1515 | netif_device_attach(ndev); |
1518 | fec_restart(ndev, fep->full_duplex); | ||
1519 | netif_device_attach(ndev); | ||
1520 | } | ||
1521 | } | 1516 | } |
1517 | |||
1522 | return 0; | 1518 | return 0; |
1523 | } | 1519 | } |
1524 | 1520 | ||