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

sata_mv: add IRQ checks

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>
Link: https://lore.kernel.org/r/51436f00-27a1-e20b-c21b-0e817e0a7c86@omprussia.ru
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Sergey Shtylyov and committed by
Jens Axboe
e6471a65 ff237990

+4
+4
drivers/ata/sata_mv.c
··· 4097 4097 n_ports = mv_platform_data->n_ports; 4098 4098 irq = platform_get_irq(pdev, 0); 4099 4099 } 4100 + if (irq < 0) 4101 + return irq; 4102 + if (!irq) 4103 + return -EINVAL; 4100 4104 4101 4105 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 4102 4106 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);