i2c: highlander: add IRQ check
PATCH 1/1 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...
---
This patch is against the 'i2c/for-current' branch of Wolfram Sang's 'linux.git' repo.
Sorry, I realized just now that this patch should have been a part of the 6-patch series (already merged)...
drivers/i2c/busses/i2c-highlander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-highlander.c +1 -1
@@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct pplatform_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) {
Wolfram Sang
AppliedQuoted 9 lines · Sergey Shtylyov
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 torequest_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 <[email protected]>
Applied to for-next, thanks!