All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sata_mv: add IRQ checks
@ 2021-03-27 21:13 Sergey Shtylyov
  2021-03-31  2:23 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2021-03-27 21:13 UTC (permalink / raw)
  To: Jens Axboe, linux-ide; +Cc: linux-kernel

The function mv_platform_probe() neglects to check the results of the
calls to platform_get_irq() and irq_of_parse_and_map() and blithely
passes them to ata_host_activate() -- while the latter only checks
for IRQ0 (treating it as a polling mode indicattion) and passes the
negative values to devm_request_irq() causing it to fail as it takes
unsigned values for the IRQ #...

Add to mv_platform_probe() the proper IRQ checks to pass the positive IRQ
#s to ata_host_activate(), propagate upstream the negative error codes,
and override the IRQ0 with -EINVAL (as we don't want the polling mode).

Fixes: f351b2d638c3 ("sata_mv: Support SoC controllers")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
 drivers/ata/sata_mv.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-block/drivers/ata/sata_mv.c
===================================================================
--- linux-block.orig/drivers/ata/sata_mv.c
+++ linux-block/drivers/ata/sata_mv.c
@@ -4097,6 +4097,10 @@ static int mv_platform_probe(struct plat
 		n_ports = mv_platform_data->n_ports;
 		irq = platform_get_irq(pdev, 0);
 	}
+	if (irq < 0)
+		return irq;
+	if (!irq)
+		return -EINVAL;
 
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
 	hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);

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

* Re: [PATCH] sata_mv: add IRQ checks
  2021-03-27 21:13 [PATCH] sata_mv: add IRQ checks Sergey Shtylyov
@ 2021-03-31  2:23 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-03-31  2:23 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-ide; +Cc: linux-kernel

On 3/27/21 3:13 PM, Sergey Shtylyov wrote:
> The function mv_platform_probe() neglects to check the results of the
> calls to platform_get_irq() and irq_of_parse_and_map() and blithely
> passes them to ata_host_activate() -- while the latter only checks
> for IRQ0 (treating it as a polling mode indicattion) and passes the
> negative values to devm_request_irq() causing it to fail as it takes
> unsigned values for the IRQ #...
> 
> Add to mv_platform_probe() the proper IRQ checks to pass the positive IRQ
> #s to ata_host_activate(), propagate upstream the negative error codes,
> and override the IRQ0 with -EINVAL (as we don't want the polling mode).

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-03-31  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 21:13 [PATCH] sata_mv: add IRQ checks Sergey Shtylyov
2021-03-31  2:23 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.