Skip to contentSkip to conversation

net: mvpp2: ptp: Fix unused variables

PATCH Applied Alex Dewar 2 participants 2 messages Sep 10, 2020

Subsystems (3)
lore
Share & tools
lore

Alex Dewar

author
#0 lore raw

PATCH 1/1 net: mvpp2: ptp: Fix unused variables

In the functions mvpp2_isr_handle_xlg() and mvpp2_isr_handle_gmac_internal(), the bool variable link is assigned a true value in the case that a given bit of val is set. However, if the bit is unset, no value is assigned to link and it is then passed to mvpp2_isr_handle_link() without being initialised. Fix by assigning to link the value of the bit test.

Build-tested on x86.

Fixes 36cfd3a6e52b ("net: mvpp2: restructure "link status" interrupt handling")
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -4
index 7d86940747d1..87b1c9cfdc77 100644
@@ -3070,8 +3070,7 @@ static void mvpp2_isr_handle_xlg(struct mvpp2_port *port)
 	val = readl(port->base + MVPP22_XLG_INT_STAT);
 	if (val & MVPP22_XLG_INT_STAT_LINK) {
 		val = readl(port->base + MVPP22_XLG_STATUS);
-		if (val & MVPP22_XLG_STATUS_LINK_UP)
-			link = true;
+		link = (val & MVPP22_XLG_STATUS_LINK_UP);
 		mvpp2_isr_handle_link(port, link);
 	}
 }
@@ -3087,8 +3086,7 @@ static void mvpp2_isr_handle_gmac_internal(struct mvpp2_port *port)
 		val = readl(port->base + MVPP22_GMAC_INT_STAT);
 		if (val & MVPP22_GMAC_INT_STAT_LINK) {
 			val = readl(port->base + MVPP2_GMAC_STATUS0);
-			if (val & MVPP2_GMAC_STATUS0_LINK_UP)
-				link = true;
+			link = (val & MVPP2_GMAC_STATUS0_LINK_UP);
 			mvpp2_isr_handle_link(port, link);
 		}
 	}
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw

From: Alex Dewar <[email protected]>
Date: Thu, 10 Sep 2020 14:49:10 +0100

Quoted 11 lines

In the functions mvpp2_isr_handle_xlg() and mvpp2_isr_handle_gmac_internal(), the bool variable link is assigned a true value in the case that a given bit of val is set. However, if the bit is unset, no value is assigned to link and it is then passed to mvpp2_isr_handle_link() without being initialised. Fix by assigning to link the value of the bit test.

Build-tested on x86.

Fixes 36cfd3a6e52b ("net: mvpp2: restructure "link status" interrupt handling")

Applied to net-next.