net/fec: no need to check for validity of ndev in suspend and resume
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 13 Jan 2011 20:53:40 +0000 (21:53 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 15 Feb 2011 08:26:28 +0000 (09:26 +0100)
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>
drivers/net/fec.c

index aa1db8e637cd817efc38db8d61b7b9d115764fb9..8026a16f6b6cdf09fae438abd54f637d129ecf3a 100644 (file)
@@ -1492,16 +1492,14 @@ static int
 fec_suspend(struct device *dev)
 {
        struct net_device *ndev = dev_get_drvdata(dev);
-       struct fec_enet_private *fep;
+       struct fec_enet_private *fep = netdev_priv(ndev);
 
-       if (ndev) {
-               fep = netdev_priv(ndev);
-               if (netif_running(ndev)) {
-                       fec_stop(ndev);
-                       netif_device_detach(ndev);
-               }
-               clk_disable(fep->clk);
+       if (netif_running(ndev)) {
+               fec_stop(ndev);
+               netif_device_detach(ndev);
        }
+       clk_disable(fep->clk);
+
        return 0;
 }
 
@@ -1509,16 +1507,14 @@ static int
 fec_resume(struct device *dev)
 {
        struct net_device *ndev = dev_get_drvdata(dev);
-       struct fec_enet_private *fep;
+       struct fec_enet_private *fep = netdev_priv(ndev);
 
-       if (ndev) {
-               fep = netdev_priv(ndev);
-               clk_enable(fep->clk);
-               if (netif_running(ndev)) {
-                       fec_restart(ndev, fep->full_duplex);
-                       netif_device_attach(ndev);
-               }
+       clk_enable(fep->clk);
+       if (netif_running(ndev)) {
+               fec_restart(ndev, fep->full_duplex);
+               netif_device_attach(ndev);
        }
+
        return 0;
 }