Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262556 > unrolled thread

[PATCH] net: stmmac: remove unneeded phy_iface variable

Started byLABBE Corentin <clabbe.montjoie@gmail.com>
First post2015-11-04 21:10 +0100
Last post2015-11-05 06:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: stmmac: remove unneeded phy_iface variable LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-11-04 21:10 +0100
    Re: [PATCH] net: stmmac: remove unneeded phy_iface variable David Miller <davem@davemloft.net> - 2015-11-05 06:40 +0100

#1262556 — [PATCH] net: stmmac: remove unneeded phy_iface variable

FromLABBE Corentin <clabbe.montjoie@gmail.com>
Date2015-11-04 21:10 +0100
Subject[PATCH] net: stmmac: remove unneeded phy_iface variable
Message-ID<qrcxz-59d-1@gated-at.bofh.it>
The variable phy_iface is double-initialized and finally is not necessary
at all.

Reported-by: coverity (CID 1271141)
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 11baa4b..26a11b7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -354,11 +354,9 @@ static int gmac_clk_init(struct rk_priv_data *bsp_priv)
 
 static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
 {
-	int phy_iface = phy_iface = bsp_priv->phy_iface;
-
 	if (enable) {
 		if (!bsp_priv->clk_enabled) {
-			if (phy_iface == PHY_INTERFACE_MODE_RMII) {
+			if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_RMII) {
 				if (!IS_ERR(bsp_priv->mac_clk_rx))
 					clk_prepare_enable(
 						bsp_priv->mac_clk_rx);
@@ -390,7 +388,7 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
 		}
 	} else {
 		if (bsp_priv->clk_enabled) {
-			if (phy_iface == PHY_INTERFACE_MODE_RMII) {
+			if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_RMII) {
 				if (!IS_ERR(bsp_priv->mac_clk_rx))
 					clk_disable_unprepare(
 						bsp_priv->mac_clk_rx);
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1262935

FromDavid Miller <davem@davemloft.net>
Date2015-11-05 06:40 +0100
Message-ID<qrlrc-2q8-23@gated-at.bofh.it>
In reply to#1262556
From: LABBE Corentin <clabbe.montjoie@gmail.com>
Date: Wed,  4 Nov 2015 21:08:12 +0100

> The variable phy_iface is double-initialized and finally is not necessary
> at all.
> 
> Reported-by: coverity (CID 1271141)
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>

The value is used in two locations, so having it computed once in a
variable is useful.

Please just eliminate the double assignment.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web