Re: [PATCH v8 04/18] spi: spi-mem: teach spi_mem_adjust_op_freq() about post-config ops

[email protected]
Newsgroups org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] spi_mem_default_supports_op() incorrectly rejects standard operations if post_config_max_speed_hz equals max_speed_hz on controllers lacking the per_op_freq capability.
--

--- Patch [4]: [PATCH v8 04/18] spi: spi-mem: teach spi_mem_adjust_op_freq() about post-config ops ---
commit 66e4cfc36fb55feef18471a08846b1db198c893f
Author: Santhosh Kumar K <[email protected]>

spi: spi-mem: teach spi_mem_adjust_op_freq() about post-config ops

This commit introduces a bypass in spi_mem_adjust_op_freq() for post-config
operations matching post_config_max_speed_hz. It also updates
spi_mem_default_supports_op() to require the per_op_freq controller
capability for these operations.

> diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
> index 5f973ebfb8b6e..cd4bc4c914e7f 100644
> --- a/drivers/spi/spi-mem.c
> +++ b/drivers/spi/spi-mem.c
> @@ -206,7 +206,8 @@ bool spi_mem_default_supports_op(struct spi_mem *mem,
>  		return false;
>  
>  	if (op->max_freq &&
> -	    op->max_freq < mem->spi->max_speed_hz) {
> +	    (op->max_freq < mem->spi->max_speed_hz ||
> +	     op->max_freq == mem->spi->post_config_max_speed_hz)) {
>  		if (!spi_mem_controller_is_capable(ctlr, per_op_freq))
>  			return false;
>  	}

[Severity: High]
Does this incorrectly reject standard operations if a device tree configures
the post-config frequency to be identical to the base max_speed_hz on
controllers lacking the per_op_freq capability?

If spi_mem_adjust_op_freq() sets op->max_freq to mem->spi->max_speed_hz
for standard operations, and post_config_max_speed_hz happens to equal
max_speed_hz, this condition will evaluate to true.

Could this unnecessarily require the per_op_freq capability for all standard
operations, such as reading the flash ID during probe, and prevent the
device from working entirely in this configuration?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.