linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ocelot: fix wront time_after usage
@ 2022-05-19 20:40 Pavel Skripkin
  2022-05-19 23:13 ` Vladimir Oltean
  2022-05-20 12:40 ` Andrew Lunn
  0 siblings, 2 replies; 12+ messages in thread
From: Pavel Skripkin @ 2022-05-19 20:40 UTC (permalink / raw)
  To: vladimir.oltean, claudiu.manoil, alexandre.belloni, UNGLinuxDriver
  Cc: davem, kuba, pabeni, dan.carpenter, netdev, linux-kernel, Pavel Skripkin

Accidentally noticed, that this driver is the only user of
while (timer_after(jiffies...)).

It looks like typo, because likely this while loop will finish after 1st
iteration, because time_after() returns true when 1st argument _is after_
2nd one.

Fix it by negating time_after return value inside while loops statement

Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/net/ethernet/mscc/ocelot_fdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
index dffa597bffe6..4500fed3ce5c 100644
--- a/drivers/net/ethernet/mscc/ocelot_fdma.c
+++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
@@ -104,7 +104,7 @@ static int ocelot_fdma_wait_chan_safe(struct ocelot *ocelot, int chan)
 		safe = ocelot_fdma_readl(ocelot, MSCC_FDMA_CH_SAFE);
 		if (safe & BIT(chan))
 			return 0;
-	} while (time_after(jiffies, timeout));
+	} while (!time_after(jiffies, timeout));
 
 	return -ETIMEDOUT;
 }
-- 
2.36.1


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

end of thread, other threads:[~2022-06-27 14:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 20:40 [PATCH] net: ocelot: fix wront time_after usage Pavel Skripkin
2022-05-19 23:13 ` Vladimir Oltean
2022-05-20  8:21   ` Clément Léger
2022-05-20 12:40 ` Andrew Lunn
2022-05-20 21:06   ` Pavel Skripkin
2022-05-20 21:31   ` [PATCH v2] net: ocelot: fix wrong " Pavel Skripkin
2022-05-21 13:55     ` Andrew Lunn
2022-05-21 16:21       ` Vladimir Oltean
2022-05-23 14:00         ` Clément Léger
2022-05-27  3:42           ` Jakub Kicinski
2022-06-24 15:14         ` Clément Léger
2022-06-27 14:46           ` Pavel Skripkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).