From: Sergey Shtylyov Date: Sun, 30 May 2021 19:13:45 +0000 (+0300) Subject: i2c: highlander: add IRQ check X-Git-Tag: v5.15~435^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f16a3bb69aa6baabf8f0aca982c8cf21e2a4f6bc;p=platform%2Fkernel%2Flinux-starfive.git 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") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c index 803dad7..a2add12 100644 --- a/drivers/i2c/busses/i2c-highlander.c +++ b/drivers/i2c/busses/i2c-highlander.c @@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct platform_device *pdev) 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) {