Re: [PATCH] spi: pic32-sqi: guard against empty BD list in pic32_sqi_one_message()
From: Mark Brown
Date: Mon Oct 26 2026 - 14:38:48 EST
> Fix it by bailing out with -EINVAL when bd_list_used is empty, before
> both list_last_entry() and list_first_entry(). The xfer_out cleanup path
> tolerates an empty list, and normal messages with at least one transfer
> are unaffected. This also matches the existing list_empty() guard in
> ring_desc_get() in the same file.
>
> + /* a message with no transfers leaves the BD list empty */
The core will reject a message with no transfers, it will allow a
message where none of the transfers have a tx_buf or rx_buf.
> + if (list_empty(&sqi->bd_list_used)) {
> + ret = -EINVAL;
> + goto xfer_out;
We need to update msg->status too, the timeout path below does the right
thing here.
--
Mark Brown <broonie@xxxxxxxxxx>