Thread (33 messages) flat view 33 messages, 3 authors, 2021-05-14

Re: [PATCH net-next v6 02/25] net: dsa: qca8k: use iopoll macro for qca8k_busy_wait

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-05-14 22:52:31
Also in: linux-devicetree, lkml

On Fri, May 14, 2021 at 10:59:52PM +0200, Ansuel Smith wrote:
Use iopoll macro instead of while loop.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This doesn't look quite right to me.
 static int
 qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask)
 {
-	unsigned long timeout;
-
-	timeout = jiffies + msecs_to_jiffies(20);
+	u32 val;
val is unsigned here.
+	/* Check if qca8k_read has failed for a different reason
+	 * before returning -ETIMEDOUT
+	 */
+	if (ret < 0 && val < 0)
but here you are checking it for a negative number - this will always be
false, making the conditional code unreachable. Either the test is wrong,
or the type of val is wrong. Please resolve.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help