[PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout

Ahmad Fatoum a.fatoum at pengutronix.de
Sat Apr 26 01:14:15 PDT 2025


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 at kleine-koenig.org>
Signed-off-by: Ahmad Fatoum <a.fatoum at 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




More information about the barebox mailing list