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
  2025-04-28  7:29 ` Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: [PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout
  2025-04-26  8:14 [PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout Ahmad Fatoum
@ 2025-04-28  7:29 ` Uwe Kleine-König
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2025-04-28  7:29 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

Hello Ahmad,

On Sat, Apr 26, 2025 at 10:14:15AM +0200, Ahmad Fatoum wrote:
> 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>

This indeed fixes networking for me. Thanks a lot for your patch.

Tested-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-by: Uwe Kleine-König <uwe@kleine-koenig.org>

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2025-04-28  7:46 UTC | newest]

Thread overview: 2+ messages (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
2025-04-28  7:29 ` Uwe Kleine-König

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