Skip to contentSkip to conversation

can: hi311x: fix a signedness bug in hi3110_cmd()

PATCH In review Dan Carpenter 2 participants 2 messages Jul 29, 2021 – Jul 30, 2021

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

PATCH 1/1 can: hi311x: fix a signedness bug in hi3110_cmd()

The hi3110_cmd() is supposed to return zero on success and negative error codes on failure, but it was accidentally declared as a u8 when it needs to be an int type.

Fixes 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver")
---
 drivers/net/can/spi/hi311x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/hi311x.c +1 -1
index dd17b8c53e1c..89d9c986a229 100644
@@ -218,7 +218,7 @@ static int hi3110_spi_trans(struct spi_device *spi, int len)
 	return ret;
 }
 
-static u8 hi3110_cmd(struct spi_device *spi, u8 command)
+static int hi3110_cmd(struct spi_device *spi, u8 command)
 {
 	struct hi3110_priv *priv = spi_get_drvdata(spi);
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Dan Carpenter

The hi3110_cmd() is supposed to return zero on success and negative error codes on failure, but it was accidentally declared as a u8 when it needs to be an int type.

Fixes 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver")

Applied to linux-can/testing.

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |