Skip to content

Commit 366763b

Browse files
Sergey Shtylyovksacilotto
Sergey Shtylyov
authored andcommitted
sata_mv: add IRQ checks
BugLink: https://bugs.launchpad.net/bugs/1929615 [ Upstream commit e6471a6 ] 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: f351b2d ("sata_mv: Support SoC controllers") Signed-off-by: Sergey Shtylyov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
1 parent 9bdbd9c commit 366763b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/ata/sata_mv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4097,6 +4097,10 @@ static int mv_platform_probe(struct platform_device *pdev)
40974097
n_ports = mv_platform_data->n_ports;
40984098
irq = platform_get_irq(pdev, 0);
40994099
}
4100+
if (irq < 0)
4101+
return irq;
4102+
if (!irq)
4103+
return -EINVAL;
41004104

41014105
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
41024106
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);

0 commit comments

Comments
 (0)