lkml.org 
[lkml]   [2022]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] net: ocelot: fix wront time_after usage
Date
On Thu, May 19, 2022 at 11:40:17PM +0300, Pavel Skripkin wrote:
> Accidentally noticed, that this driver is the only user of
> while (timer_after(jiffies...)).
>
> It looks like typo, because likely this while loop will finish after 1st
> iteration, because time_after() returns true when 1st argument _is after_
> 2nd one.
>
> Fix it by negating time_after return value inside while loops statement
>
> Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
> drivers/net/ethernet/mscc/ocelot_fdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
> index dffa597bffe6..4500fed3ce5c 100644
> --- a/drivers/net/ethernet/mscc/ocelot_fdma.c
> +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
> @@ -104,7 +104,7 @@ static int ocelot_fdma_wait_chan_safe(struct ocelot *ocelot, int chan)
> safe = ocelot_fdma_readl(ocelot, MSCC_FDMA_CH_SAFE);
> if (safe & BIT(chan))
> return 0;
> - } while (time_after(jiffies, timeout));
> + } while (!time_after(jiffies, timeout));
>
> return -ETIMEDOUT;
> }
> --
> 2.36.1
>

+Clement. Also, there seems to be a typo in the commit message (wront -> wrong),
but maybe this isn't so important.
\
 
 \ /
  Last update: 2022-05-20 01:14    [W:0.425 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site