[PATCH v3 03/13] spi: parse two-element spi-max-frequency property

Miquel Raynal miquel.raynal at bootlin.com
Thu May 28 01:37:33 PDT 2026


>  
> -	/* Device speed */
> -	if (!of_property_read_u32(nc, "spi-max-frequency", &value))
> +	/*
> +	 * Device speed: a single value sets max_speed_hz; two values set
> +	 * base_speed_hz (conservative) and max_speed_hz (maximum after
> +	 * controller-side configuration).
> +	 */
> +	nfreq = of_property_count_u32_elems(nc, "spi-max-frequency");
> +	if (nfreq == 2) {
> +		of_property_read_u32_index(nc, "spi-max-frequency", 0,
> +					   &spi->base_speed_hz);
> +		of_property_read_u32_index(nc, "spi-max-frequency", 1,
> +					   &spi->max_speed_hz);

I don't know how useful that is, but I would use an intermediate
variable and check the return value of the of_property_* helper before
filling spi->max|base_speed_hz.

With this fixed,

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>

Thanks,
Miquèl



More information about the linux-mtd mailing list