Skip to content

Commit

Permalink
i2c: highlander: add IRQ check
Browse files Browse the repository at this point in the history
[ Upstream commit f16a3bb ]

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: 4ad48e6 ("i2c: Renesas Highlander FPGA SMBus support")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Sergey Shtylyov authored and gregkh committed Sep 15, 2021
1 parent 11dd40c commit eef8496
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-highlander.c
Expand Up @@ -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) {
Expand Down

0 comments on commit eef8496

Please sign in to comment.