diff options
author | Sergey Shtylyov <s.shtylyov@omp.ru> | 2021-05-30 22:13:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-22 11:47:52 +0200 |
commit | d9281b86a0b444ffc313212643ac192fc47eac8c (patch) | |
tree | f96d5fcf428b35d080064164e188932537f0907d /drivers | |
parent | b7d1479e2364430f62c97fe53b6ad7f3d3f5b13e (diff) | |
download | linux-stable-d9281b86a0b444ffc313212643ac192fc47eac8c.tar.gz linux-stable-d9281b86a0b444ffc313212643ac192fc47eac8c.tar.bz2 linux-stable-d9281b86a0b444ffc313212643ac192fc47eac8c.zip |
i2c: highlander: add IRQ check
[ Upstream commit f16a3bb69aa6baabf8f0aca982c8cf21e2a4f6bc ]
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 <s.shtylyov@omp.ru>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-highlander.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c index ff340d7ae2e5..6a880c262380 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) { |