[PATCH v5 2/2] spi: spi-mem: Add Realtek SPI NOR flash controller driver
From: Dan Carpenter
Date: Fri Oct 02 2026 - 07:13:01 EST
Commit aca8cbecdd2e ("spi: spi-mem: Add Realtek SPI NOR flash
controller driver") from Sep 30, 2026 (linux-next), leads to the
following Smatch static checker warning:
drivers/spi/spi-rtk-nor.c:347 rtk_spi_supports_op()
warn: '(-95)' is not bool
On Wed, 30 Sep 2026 14:59:45 +0800 Yu-Chun Lin <eleanor.lin@xxxxxxxxxxx> wrote:
> +static bool rtk_spi_supports_op(struct spi_mem *mem,
> + const struct spi_mem_op *op)
> +{
> + if (op->cmd.buswidth != 1)
> + return false;
> +
> + if (op->cmd.dtr || op->addr.dtr || op->data.dtr)
> + return false;
> +
> + if (op->addr.nbytes != 0) {
> + if (op->addr.buswidth > 1)
> + return false;
> + if (op->addr.nbytes < 3 || op->addr.nbytes > 4)
> + return false;
> + }
> +
> + /*
> + * The data window is access-triggered: each CPU access to host->iobase
> + * generates one complete SPI transaction. Consecutive byte accesses
> + * therefore cannot be merged into a single transaction, so
> + * multi-byte stateless commands are not supported by this controller.
> + */
> + if (!op->addr.nbytes && op->data.nbytes > 1)
> + return -EOPNOTSUPP;
This is a bool function. s/-EOPNOTSUPP/false/?
regards,
dan carpenter
> +
> + if (op->dummy.nbytes != 0) {
> + if (op->dummy.buswidth > 1 || op->dummy.nbytes > 7)
> + return false;
> + }
> +
> + if (op->data.nbytes != 0 && op->data.buswidth > 2)
> + return false;
> +
> + return spi_mem_default_supports_op(mem, op);
> +}