[PATCH linux-next] e1000: Remove redundant statement

Subsystems: intel ethernet drivers, networking drivers, the rest

STALE1760d

4 messages, 3 authors, 2021-10-21 · open the first message on its own page

[PATCH linux-next] e1000: Remove redundant statement

From: luo penghao <hidden>
Date: 2021-10-18 08:53:16

This statement is redundant in the context, because there will be
an identical statement next. otherwise, the variable initialization
is actually unnecessary.

The clang_analyzer complains as follows:

drivers/net/ethernet/intel/e1000/e1000_ethtool.c:1218:2 warning:

Value stored to 'ctrl_reg' is never read.

Reported-by: Zeal Robot <redacted>
Signed-off-by: luo penghao <redacted>
---
 drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 0a57172..8951f2a 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1215,8 +1215,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
 		e1000_write_phy_reg(hw, PHY_CTRL, 0x8140);
 	}
 
-	ctrl_reg = er32(CTRL);
-
 	/* force 1000, set loopback */
 	e1000_write_phy_reg(hw, PHY_CTRL, 0x4140);
 
-- 
2.15.2

Re: [PATCH linux-next] e1000: Remove redundant statement

From: Simon Horman <horms@kernel.org>
Date: 2021-10-20 09:25:45

On Mon, Oct 18, 2021 at 08:53:05AM +0000, luo penghao wrote:

nit: s/linux-next/net-next/ in subject
This statement is redundant in the context, because there will be
an identical statement next. otherwise, the variable initialization
is actually unnecessary.

The clang_analyzer complains as follows:

drivers/net/ethernet/intel/e1000/e1000_ethtool.c:1218:2 warning:

Value stored to 'ctrl_reg' is never read.
I agree this does seem to be the case.
Reported-by: Zeal Robot <redacted>
Signed-off-by: luo penghao <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
quoted hunk
---
 drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 0a57172..8951f2a 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1215,8 +1215,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
 		e1000_write_phy_reg(hw, PHY_CTRL, 0x8140);
 	}
 
-	ctrl_reg = er32(CTRL);
-
 	/* force 1000, set loopback */
 	e1000_write_phy_reg(hw, PHY_CTRL, 0x4140);
 
-- 
2.15.2

Re: [Intel-wired-lan] [PATCH linux-next] e1000: Remove redundant statement

From: Jesse Brandeburg <hidden>
Date: 2021-10-20 18:08:25

Apologies for the duplicates, mail from my intel account going out
through outlook.com is not being delivered.

On Wed, Oct 20, 2021 at 7:00 AM Simon Horman [off-list ref] wrote:
quoted
Value stored to 'ctrl_reg' is never read.
I agree this does seem to be the case.
quoted
Reported-by: Zeal Robot <redacted>
Signed-off-by: luo penghao <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
Thanks for the review, but (davem/kuba) please do not apply.
quoted
@@ -1215,8 +1215,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
              e1000_write_phy_reg(hw, PHY_CTRL, 0x8140);
      }

-     ctrl_reg = er32(CTRL);
Thanks for your patch, but this change is not safe. you're removing a
read that could do two things. The first is that the read "flushes"
the write just above to PCI (it's a PCI barrier), and the second is
that the read can have some side effects.

If this change must be done, the code should be to remove the
assignment to ctrl_reg, but leave the read, so the line would just
look like:
        er32(CTRL);

This will get rid of the warning and not change the flow from the
hardware perspective.
quoted
-
      /* force 1000, set loopback */
      e1000_write_phy_reg(hw, PHY_CTRL, 0x4140);
Please do not apply this.

Re: [Intel-wired-lan] [PATCH linux-next] e1000: Remove redundant statement

From: Simon Horman <horms@kernel.org>
Date: 2021-10-21 07:09:55

On Wed, Oct 20, 2021 at 11:08:11AM -0700, Jesse Brandeburg wrote:
Apologies for the duplicates, mail from my intel account going out
through outlook.com is not being delivered.

On Wed, Oct 20, 2021 at 7:00 AM Simon Horman [off-list ref] wrote:
quoted
quoted
Value stored to 'ctrl_reg' is never read.
I agree this does seem to be the case.
quoted
Reported-by: Zeal Robot <redacted>
Signed-off-by: luo penghao <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
Thanks for the review, but (davem/kuba) please do not apply.
Thanks, and sorry for misunderstanding the patch.
quoted
quoted
@@ -1215,8 +1215,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
              e1000_write_phy_reg(hw, PHY_CTRL, 0x8140);
      }

-     ctrl_reg = er32(CTRL);
Thanks for your patch, but this change is not safe. you're removing a
read that could do two things. The first is that the read "flushes"
the write just above to PCI (it's a PCI barrier), and the second is
that the read can have some side effects.

If this change must be done, the code should be to remove the
assignment to ctrl_reg, but leave the read, so the line would just
look like:
        er32(CTRL);

This will get rid of the warning and not change the flow from the
hardware perspective.
quoted
quoted
-
      /* force 1000, set loopback */
      e1000_write_phy_reg(hw, PHY_CTRL, 0x4140);
Please do not apply this.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help