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

scsi: jazz_esp: Add IRQ check

The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding the real
error code. Stop calling request_irq() with the invalid IRQ #s.

Link: https://lore.kernel.org/r/594aa9ae-2215-49f6-f73c-33bd38989912@omprussia.ru
Fixes: 352e921f0dd4 ("[SCSI] jazz_esp: converted to use esp_core")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Sergey Shtylyov and committed by
Martin K. Petersen
38fca15c 6c11dc06

+3 -1
+3 -1
drivers/scsi/jazz_esp.c
··· 143 143 if (!esp->command_block) 144 144 goto fail_unmap_regs; 145 145 146 - host->irq = platform_get_irq(dev, 0); 146 + host->irq = err = platform_get_irq(dev, 0); 147 + if (err < 0) 148 + goto fail_unmap_command_block; 147 149 err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); 148 150 if (err < 0) 149 151 goto fail_unmap_command_block;