public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: highlander: add IRQ check
@ 2021-05-30 19:13 Sergey Shtylyov
  2021-08-03 20:49 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2021-05-30 19:13 UTC (permalink / raw)
  To: linux-i2c

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>

---
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(-)

Index: linux/drivers/i2c/busses/i2c-highlander.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-highlander.c
+++ linux/drivers/i2c/busses/i2c-highlander.c
@@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct p
 	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) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-03 20:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-30 19:13 [PATCH] i2c: highlander: add IRQ check Sergey Shtylyov
2021-08-03 20:49 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox