Skip to content

Commit a38b778

Browse files
Sergey Shtylyovgregkh
authored andcommitted
i2c: sh7760: add IRQ check
[ Upstream commit e5b2e3e ] 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: a26c20b ("i2c: Renesas SH7760 I2C master driver") Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4b81777 commit a38b778

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev)
471471
goto out2;
472472
}
473473

474-
id->irq = platform_get_irq(pdev, 0);
474+
ret = platform_get_irq(pdev, 0);
475+
if (ret < 0)
476+
return ret;
477+
id->irq = ret;
475478

476479
id->adap.nr = pdev->id;
477480
id->adap.algo = &sh7760_i2c_algo;

0 commit comments

Comments
 (0)