[PATCH][next] spi: SPISG: Fix less than zero comparison on a u32 variable

Xianwei Zhao xianwei.zhao at amlogic.com
Sun Jul 27 19:13:12 PDT 2025


Reviewed-by: Xianwei Zhao <xianwei.zhao at amlogic.com>
On 2025/7/26 01:17, Colin Ian King wrote:
> [Some people who received this message don't often get email from colin.i.king at gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> [ EXTERNAL EMAIL ]
> 
> The check for ns < 0 is always false because variable ns is a u32 which
> is not a signed type. Fix this by making ns a s32 type.
> 
> Fixes: cef9991e04ae ("spi: Add Amlogic SPISG driver")
> Signed-off-by: Colin Ian King <colin.i.king at gmail.com>
> ---
>   drivers/spi/spi-amlogic-spisg.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-amlogic-spisg.c b/drivers/spi/spi-amlogic-spisg.c
> index 48a5325b4db7..2ab8bdf2a676 100644
> --- a/drivers/spi/spi-amlogic-spisg.c
> +++ b/drivers/spi/spi-amlogic-spisg.c
> @@ -163,7 +163,7 @@ struct spisg_device {
> 
>   static int spi_delay_to_sclk(u32 slck_speed_hz, struct spi_delay *delay)
>   {
> -       u32 ns;
> +       s32 ns;
> 
>          if (!delay)
>                  return 0;
> --
> 2.50.0
> 



More information about the linux-amlogic mailing list