]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
drivers: net: xgene: Check for IS_ERR rather than NULL for clock.
[linux.git] / drivers / net / ethernet / apm / xgene / xgene_enet_sgmac.c
index ff240b3cb2b877cf968fa80fcb933eb6ddfc89ac..05b817e56fdeb2637413b6ae199301c1797851aa 100644 (file)
@@ -334,9 +334,11 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
        if (!xgene_ring_mgr_init(p))
                return -ENODEV;
 
-       clk_prepare_enable(p->clk);
-       clk_disable_unprepare(p->clk);
-       clk_prepare_enable(p->clk);
+       if (!IS_ERR(p->clk)) {
+               clk_prepare_enable(p->clk);
+               clk_disable_unprepare(p->clk);
+               clk_prepare_enable(p->clk);
+       }
 
        xgene_enet_ecc_init(p);
        xgene_enet_config_ring_if_assoc(p);
@@ -369,7 +371,8 @@ static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
 
 static void xgene_enet_shutdown(struct xgene_enet_pdata *p)
 {
-       clk_disable_unprepare(p->clk);
+       if (!IS_ERR(p->clk))
+               clk_disable_unprepare(p->clk);
 }
 
 static void xgene_enet_link_state(struct work_struct *work)