Re: [PATCH v4] net: ocelot: fix wrong time_after usage

From: Vladimir Oltean
Date: Wed Jul 06 2022 - 09:30:49 EST


On Wed, Jul 06, 2022 at 04:28:45PM +0300, Pavel Skripkin wrote:
> Accidentally noticed, that this driver is the only user of
> while (time_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.
>
> There is one possible problem with this poll loop: the scheduler could put
> the thread to sleep, and it does not get woken up for
> OCELOT_FDMA_CH_SAFE_TIMEOUT_US. During that time, the hardware has done
> its thing, but you exit the while loop and return -ETIMEDOUT.
>
> Fix it by using sane poll API that avoids all problems described above
>
> Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
> Suggested-by: Andrew Lunn <andrew@xxxxxxx>
> Signed-off-by: Pavel Skripkin <paskripkin@xxxxxxxxx>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>

This patch should target the "net" tree.