Skip to contentSkip to conversation

i2c: highlander: add IRQ check

PATCH Applied Sergey Shtylyov 2 participants 2 messages May 30, 2021 – Aug 3, 2021 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: highlander: add IRQ check

The driver is written as if platform_get_irq() returns 0 on errors (while actually it returns a negative error code), blithely passing these error codes to request_irq() (which takes *unsigned* IRQ #) -- which fails with -EINVAL. Add the necessary error check to the pre-existing *if* statement forcing the driver into the polling mode...

Fixes 4ad48e6ab18c ("i2c: Renesas Highlander FPGA SMBus support")

---
This patch is against the 'i2c/for-current' branch of Wolfram Sang's 'linux.git' repo.
Sorry, I realized just now that this patch should have been a part of the 6-patch series (already merged)...

 drivers/i2c/busses/i2c-highlander.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-highlander.c +1 -1
Index: linux/drivers/i2c/busses/i2c-highlander.c
===================================================================
@@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct p
 	platform_set_drvdata(pdev, dev);
 
 	dev->irq = platform_get_irq(pdev, 0);
-	if (iic_force_poll)
+	if (dev->irq < 0 || iic_force_poll)
 		dev->irq = 0;
 
 	if (dev->irq) {
Applied
#1 lore raw
Quoted 9 lines · Sergey Shtylyov

The driver is written as if platform_get_irq() returns 0 on errors (while actually it returns a negative error code), blithely passing these error codes to request_irq() (which takes *unsigned* IRQ #) -- which fails with -EINVAL. Add the necessary error check to the pre-existing *if* statement forcing the driver into the polling mode...

Fixes 4ad48e6ab18c ("i2c: Renesas Highlander FPGA SMBus support")

Applied to for-next, thanks!