Re: [PATCH] spi: hisi-kunpeng: prevent infinite while() loop in hisi_spi_flush_fifo

From: Mark Brown

Date: Wed Mar 18 2026 - 09:17:19 EST


On Wed, Mar 18, 2026 at 04:02:43PM +0800, Pei Xiao wrote:

> Also add a ratelimited warning when the outer limit expires, to aid in
> debugging hardware stalls.

That's a bit of a separate change, should really have been a separate
patch...

> } while (hisi_spi_busy(hs) && limit--);
> +
> + if (!limit)
> + dev_warn_ratelimited(hs->dev, "SPI busy timeout\n");
> }

The limit check is a postdecrement so we read the value, compare it to
0, subtract 1 and then break out of the loop - that means that when we
come out of the loop the value of limit is non-zero again and the
warning won't trigger.

Attachment: signature.asc
Description: PGP signature