[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YJ8Clibm/95FOz4D@Ansuel-xps.localdomain>
Date: Sat, 15 May 2021 01:07:02 +0200
From: Ansuel Smith <ansuelsmth@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v6 02/25] net: dsa: qca8k: use iopoll macro for
qca8k_busy_wait
On Fri, May 14, 2021 at 11:52:25PM +0100, Russell King (Oracle) wrote:
> 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@...il.com>
> > Reviewed-by: Andrew Lunn <andrew@...n.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.
>
I know this is wrong and I will fix.
Anyway I tested this and I checked if with u32 a negative value was
actually provided and to my surprise the value was correctly returned.
Any idea why?
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists