Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pata_ipx4xx_cf: fix IRQ check

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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Sergey Shtylyov and committed by
Jens Axboe
e379b40c c7e8f404

+5 -1
+5 -1
drivers/ata/pata_ixp4xx_cf.c
··· 165 165 return -ENOMEM; 166 166 167 167 irq = platform_get_irq(pdev, 0); 168 - if (irq) 168 + if (irq > 0) 169 169 irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); 170 + else if (irq < 0) 171 + return irq; 172 + else 173 + return -EINVAL; 170 174 171 175 /* Setup expansion bus chip selects */ 172 176 *data->cs0_cfg = data->cs0_bits;