Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: stmmac: minor cleanups to stmmac_bus_clks_config()

stmmac_bus_clks_config() doesn't need to repeatedly on dereference
priv->plat as this remains the same throughout this function. Not only
does this detract from the function's readability, but it could cause
the value to be reloaded each time. Use a local variable.

Also, the final return can simply return zero, and we can dispense
with the initialiser for 'ret'.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/E1urBvf-000000002ii-37Ce@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
2584ed25 bafdd920

+14 -13
+14 -13
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 149 149 150 150 int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled) 151 151 { 152 - int ret = 0; 152 + struct plat_stmmacenet_data *plat_dat = priv->plat; 153 + int ret; 153 154 154 155 if (enabled) { 155 - ret = clk_prepare_enable(priv->plat->stmmac_clk); 156 + ret = clk_prepare_enable(plat_dat->stmmac_clk); 156 157 if (ret) 157 158 return ret; 158 - ret = clk_prepare_enable(priv->plat->pclk); 159 + ret = clk_prepare_enable(plat_dat->pclk); 159 160 if (ret) { 160 - clk_disable_unprepare(priv->plat->stmmac_clk); 161 + clk_disable_unprepare(plat_dat->stmmac_clk); 161 162 return ret; 162 163 } 163 - if (priv->plat->clks_config) { 164 - ret = priv->plat->clks_config(priv->plat->bsp_priv, enabled); 164 + if (plat_dat->clks_config) { 165 + ret = plat_dat->clks_config(plat_dat->bsp_priv, enabled); 165 166 if (ret) { 166 - clk_disable_unprepare(priv->plat->stmmac_clk); 167 - clk_disable_unprepare(priv->plat->pclk); 167 + clk_disable_unprepare(plat_dat->stmmac_clk); 168 + clk_disable_unprepare(plat_dat->pclk); 168 169 return ret; 169 170 } 170 171 } 171 172 } else { 172 - clk_disable_unprepare(priv->plat->stmmac_clk); 173 - clk_disable_unprepare(priv->plat->pclk); 174 - if (priv->plat->clks_config) 175 - priv->plat->clks_config(priv->plat->bsp_priv, enabled); 173 + clk_disable_unprepare(plat_dat->stmmac_clk); 174 + clk_disable_unprepare(plat_dat->pclk); 175 + if (plat_dat->clks_config) 176 + plat_dat->clks_config(plat_dat->bsp_priv, enabled); 176 177 } 177 178 178 - return ret; 179 + return 0; 179 180 } 180 181 EXPORT_SYMBOL_GPL(stmmac_bus_clks_config); 181 182