mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout
@ 2025-04-26  8:14 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2025-04-26  8:14 UTC (permalink / raw)
  To: barebox; +Cc: Uwe Kleine-König, Ahmad Fatoum

If there is no timeout, we wait indefinitely and don't care for the
initial time. A fixup to silence a warning because of multiplication in
boolean context added an explicit comparison and this ended up omitting
get_time_ns() in the wrong case.

Flip it to fix, among others, MDIO on RK3568.

Fixes: 554bbc479c09 ("include: linux/iopoll.h: add optional PBL support")
Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/iopoll.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 61d8f4714e97..c38190272606 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -43,7 +43,7 @@
  */
 #define read_poll_timeout(op, val, cond, timeout_us, args...)	\
 ({ \
-	uint64_t start = (timeout_us) == 0 ? read_poll_get_time_ns() : 0; \
+	uint64_t start = (timeout_us) != 0 ? read_poll_get_time_ns() : 0; \
 	for (;;) { \
 		(val) = op(args); \
 		if (cond) \
-- 
2.39.5




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-26  8:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-26  8:14 [PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout Ahmad Fatoum

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