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

From: Pei Xiao

Date: Wed Mar 18 2026 - 21:22:04 EST



在 2026/3/18 21:17, Mark Brown 写道:
> 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...
ok.
>> } 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.

yes, my fault! I will use   '--limit'.

Thanks for your review and response!

Pei.