mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: "Uwe Kleine-König" <uwe@kleine-koenig.org>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH master] linux/iopoll: fix inverted condition in read_poll_timeout
Date: Sat, 26 Apr 2025 10:14:15 +0200	[thread overview]
Message-ID: <20250426081415.3553913-1-a.fatoum@pengutronix.de> (raw)

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




                 reply	other threads:[~2025-04-26  8:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250426081415.3553913-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=uwe@kleine-koenig.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox