diff mbox series

[2/2] pata_ipx4xx_cf: fix IRQ check

Message ID 9ff04a35-dbc8-67fa-4076-05446b4fce48@omprussia.ru
State New
Headers show
Series Correctly handle plaform_get_irq()'s result in the libata drivers | expand

Commit Message

Sergey Shtylyov March 25, 2021, 8:51 p.m. UTC
The driver's probe() method is written as if platform_get_irq() returns 0
on error, while actually it returns a negative error code (with all the
other values considered valid IRQs).  Rewrite the driver's IRQ checking
code to pass the positive IRQ #s to ata_host_activate(), propagate errors
upstream, and treat IRQ0 as error, returning -EINVAL, as the libata code
treats 0  as  an indication that polling should be used anyway...

Fixes: 0df0d0a0ea9f ("[libata] ARM: add ixp4xx PATA driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
 drivers/ata/pata_ixp4xx_cf.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

Index: linux-block/drivers/ata/pata_ixp4xx_cf.c
===================================================================
--- linux-block.orig/drivers/ata/pata_ixp4xx_cf.c
+++ linux-block/drivers/ata/pata_ixp4xx_cf.c
@@ -165,8 +165,12 @@  static int ixp4xx_pata_probe(struct plat
 		return -ENOMEM;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq)
+	if (irq > 0)
 		irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
+	else if (irq < 0)
+		return irq;
+	else
+		return -EINVAL;
 
 	/* Setup expansion bus chip selects */
 	*data->cs0_cfg = data->cs0_bits;