Skip to content

Commit c5e5f7a

Browse files
Sergey Shtylyovwsakernel
authored andcommitted
i2c: jz4780: add IRQ check
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: ba92222 ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780") Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent bb6129c commit c5e5f7a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/i2c/busses/i2c-jz4780.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
825825

826826
jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0);
827827

828-
i2c->irq = platform_get_irq(pdev, 0);
828+
ret = platform_get_irq(pdev, 0);
829+
if (ret < 0)
830+
goto err;
831+
i2c->irq = ret;
829832
ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0,
830833
dev_name(&pdev->dev), i2c);
831834
if (ret)

0 commit comments

Comments
 (0)