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

* Re: [PATCH] i2c: highlander: add IRQ check
  2021-05-30 19:13 [PATCH] i2c: highlander: add IRQ check Sergey Shtylyov
@ 2021-08-03 20:49 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2021-08-03 20:49 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

On Sun, May 30, 2021 at 10:13:45PM +0300, Sergey Shtylyov wrote:
> 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>
> 

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ 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