Commit b2527eb2 authored by Zhang Changzhong's avatar Zhang Changzhong Committed by Marc Kleine-Budde

can: mscan: simplify clock enable/disable

All the NULL checks are pointless, clk_*() routines already deal with
NULL just fine.
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
Link: https://lore.kernel.org/r/1594972875-27631-1-git-send-email-zhangchangzhong@huawei.comSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 01fb4254
...@@ -541,16 +541,12 @@ static int mscan_open(struct net_device *dev) ...@@ -541,16 +541,12 @@ static int mscan_open(struct net_device *dev)
struct mscan_priv *priv = netdev_priv(dev); struct mscan_priv *priv = netdev_priv(dev);
struct mscan_regs __iomem *regs = priv->reg_base; struct mscan_regs __iomem *regs = priv->reg_base;
if (priv->clk_ipg) { ret = clk_prepare_enable(priv->clk_ipg);
ret = clk_prepare_enable(priv->clk_ipg); if (ret)
if (ret) goto exit_retcode;
goto exit_retcode; ret = clk_prepare_enable(priv->clk_can);
} if (ret)
if (priv->clk_can) { goto exit_dis_ipg_clock;
ret = clk_prepare_enable(priv->clk_can);
if (ret)
goto exit_dis_ipg_clock;
}
/* common open */ /* common open */
ret = open_candev(dev); ret = open_candev(dev);
...@@ -584,11 +580,9 @@ static int mscan_open(struct net_device *dev) ...@@ -584,11 +580,9 @@ static int mscan_open(struct net_device *dev)
napi_disable(&priv->napi); napi_disable(&priv->napi);
close_candev(dev); close_candev(dev);
exit_dis_can_clock: exit_dis_can_clock:
if (priv->clk_can) clk_disable_unprepare(priv->clk_can);
clk_disable_unprepare(priv->clk_can);
exit_dis_ipg_clock: exit_dis_ipg_clock:
if (priv->clk_ipg) clk_disable_unprepare(priv->clk_ipg);
clk_disable_unprepare(priv->clk_ipg);
exit_retcode: exit_retcode:
return ret; return ret;
} }
...@@ -607,10 +601,8 @@ static int mscan_close(struct net_device *dev) ...@@ -607,10 +601,8 @@ static int mscan_close(struct net_device *dev)
close_candev(dev); close_candev(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (priv->clk_can) clk_disable_unprepare(priv->clk_can);
clk_disable_unprepare(priv->clk_can); clk_disable_unprepare(priv->clk_ipg);
if (priv->clk_ipg)
clk_disable_unprepare(priv->clk_ipg);
return 0; return 0;
} }
......
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