mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: mvpp2: ptp: Fix unused variables
@ 2020-09-10 13:49 Alex Dewar
  2020-09-10 22:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Dewar @ 2020-09-10 13:49 UTC (permalink / raw)
  Cc: Alex Dewar, David S. Miller, Jakub Kicinski, Russell King,
	Matteo Croce, Sven Auhagen, Andrew Lunn, netdev, linux-kernel

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")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 7d86940747d1..87b1c9cfdc77 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -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);
 		}
 	}
-- 
2.28.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-10 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 13:49 [PATCH] net: mvpp2: ptp: Fix unused variables Alex Dewar
2020-09-10 22:16 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®