Skip to contentSkip to conversation

spi: SPISG: Fix less than zero comparison on a u32 variable

PATCH In review Colin Ian King 3 participants 3 messages Jul 25, 2025 – Jul 28, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: SPISG: Fix less than zero comparison on a u32 variable

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")
---
 drivers/spi/spi-amlogic-spisg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-amlogic-spisg.c +1 -1
index 48a5325b4db7..2ab8bdf2a676 100644
@@ -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;
Signature · 1 line
2.50.0
maintainer
#1 lore raw
Quoted 4 lines · Colin Ian King

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.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: SPISG: Fix less than zero comparison on a u32 variable

      commit: 2d442a0c781403702de27ccfbc4bb233721585f5

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Colin Ian King
Quoted 29 lines · Colin Ian King

[Some people who received this message don't often get email from [email protected]. 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")
---
  drivers/spi/spi-amlogic-spisg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-amlogic-spisg.c +1 -2
index 48a5325b4db7..2ab8bdf2a676 100644
@@ -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