Commit c2d33bdc authored by Suman Tripathi's avatar Suman Tripathi Committed by David S. Miller

drivers: net: xgene: Check for IS_ERR rather than NULL for clock.

This patches fixes the code to check for IS_ERR rather
than NULL for clock interface.
Signed-off-by: default avatarIyappan Subramanian <isubramanian@apm.com>
Signed-off-by: default avatarSuman Tripathi <stripathi@apm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 822e34a4
......@@ -610,7 +610,7 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
if (!xgene_ring_mgr_init(pdata))
return -ENODEV;
if (pdata->clk) {
if (!IS_ERR(pdata->clk)) {
clk_prepare_enable(pdata->clk);
clk_disable_unprepare(pdata->clk);
clk_prepare_enable(pdata->clk);
......@@ -629,6 +629,7 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
{
if (!IS_ERR(pdata->clk))
clk_disable_unprepare(pdata->clk);
}
......
......@@ -1036,7 +1036,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
pdata->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pdata->clk)) {
/* Firmware may have set up the clock already. */
pdata->clk = NULL;
dev_info(dev, "clocks have been setup already\n");
}
if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
......
......@@ -334,9 +334,11 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
if (!xgene_ring_mgr_init(p))
return -ENODEV;
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,6 +371,7 @@ static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
static void xgene_enet_shutdown(struct xgene_enet_pdata *p)
{
if (!IS_ERR(p->clk))
clk_disable_unprepare(p->clk);
}
......
......@@ -256,9 +256,11 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
if (!xgene_ring_mgr_init(pdata))
return -ENODEV;
if (!IS_ERR(pdata->clk)) {
clk_prepare_enable(pdata->clk);
clk_disable_unprepare(pdata->clk);
clk_prepare_enable(pdata->clk);
}
xgene_enet_ecc_init(pdata);
xgene_enet_config_ring_if_assoc(pdata);
......@@ -285,6 +287,7 @@ static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
{
if (!IS_ERR(pdata->clk))
clk_disable_unprepare(pdata->clk);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment