Re: [PATCH] serial: 8250_omap: fix a timeout loop condition

Andy Shevchenko
2021-04-29T11:08:57Z

On Thu, Apr 29, 2021 at 10:19:22AM +0300, Dan Carpenter wrote:
> This loop ends on -1 so the error message will never be printed.
>
> Fixes: 4bcf59a5dea0 ("serial: 8250: 8250_omap: Account for data in flight during DMA teardown")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

...

> poll_count--)
> cpu_relax();
>
> - if (!poll_count)
> + if (poll_count == -1)

Why not to change poll_count-- to --poll_count?

I would even prefer to replace entire loop with read_poll_timeout_atomic(). But
do we even need atomic here?

--
With Best Regards,
Andy Shevchenko