[PATCH] spi: aspeed: Replace VLA parameter with flat pointer in calibration helper

Cédric Le Goater clg at kaod.org
Mon May 18 22:24:53 PDT 2026


On 5/18/26 11:57, Chin-Ting Kuo wrote:
> aspeed_spi_ast2600_optimized_timing() declared its buffer argument as a
> variable-length array parameter (u8 buf[rows][cols]), which causes a
> sparse warning. Replace the VLA parameter with a plain u8 * and compute
> the 2-D index manually. The corresponding call site is also updated.
> 
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605180441.uD3toFRJ-lkp@intel.com/
> Signed-off-by: Chin-Ting Kuo <chin-ting_kuo at aspeedtech.com>
> ---
>   drivers/spi/spi-aspeed-smc.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c
> index 808659a1f460..c5275700de3d 100644
> --- a/drivers/spi/spi-aspeed-smc.c
> +++ b/drivers/spi/spi-aspeed-smc.c
> @@ -1467,8 +1467,7 @@ static int aspeed_spi_do_calibration(struct aspeed_spi_chip *chip)
>    * must contains the highest number of consecutive "pass"
>    * results and not span across multiple rows.
>    */
> -static u32 aspeed_spi_ast2600_optimized_timing(u32 rows, u32 cols,
> -					       u8 buf[rows][cols])
> +static u32 aspeed_spi_ast2600_optimized_timing(u32 rows, u32 cols, u8 *buf)
>   {
>   	int r = 0, c = 0;
>   	int max = 0;
> @@ -1478,7 +1477,7 @@ static u32 aspeed_spi_ast2600_optimized_timing(u32 rows, u32 cols,
>   		for (j = 0; j < cols;) {
>   			int k = j;
>   
> -			while (k < cols && buf[i][k])
> +			while (k < cols && buf[i * cols + k])
>   				k++;
>   
>   			if (k - j > max) {
> @@ -1541,7 +1540,7 @@ static int aspeed_spi_ast2600_calibrate(struct aspeed_spi_chip *chip, u32 hdiv,
>   		}
>   	}
>   
> -	calib_point = aspeed_spi_ast2600_optimized_timing(6, 17, calib_res);
> +	calib_point = aspeed_spi_ast2600_optimized_timing(6, 17, &calib_res[0][0]);
>   	/* No good setting for this frequency */
>   	if (calib_point == 0)
>   		return -1;



Reviewed-by: Cédric Le Goater <clg at kaod.org>

Thanks,

C.




More information about the linux-arm-kernel mailing list