Add scsi_add_host() failure handling for nsp32
Subsystems (2)
PATCH 1/1 Add scsi_add_host() failure handling for nsp32
From: Jesper Juhl <[email protected]>
Add scsi_add_host() failure handling for nsp32
and silence warning.
drivers/scsi/nsp32.c:2888: warning: ignoring return value of csi_add_host', declared with attribute warn_unused_result
---
drivers/scsi/nsp32.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/nsp32.c +6 -1
@@ -2885,7 +2885,12 @@ static int nsp32_detect(struct scsi_host }#if (LINUX_VERSION_CODE >KERNEL_VERSION (2 ,5 ,73 )) -scsi_add_host (host, &PCIDEV ->dev); + ret =scsi_add_host (host, &PCIDEV ->dev); +if (ret) { +printk (KERN_WARNING "nsp32: scsi_add_host failed\n" ); +scsi_host_put (host); +return ret; + }scsi_scan_host (host);#endif pci_set_drvdata (PCIDEV , host);
PS. Please CC me on replies from linux-scsi since I'm not subscribed there.
Signature · 1 line
Jesper Juhl
Dear Jesper,
At Tue, 10 Jan 2006 14:11:52 +0100,
Quoted 3 lines · Jesper Juhl
Add
scsi_add_host()failure handling for nsp32
and silence warning.
drivers/scsi/nsp32.c:2888: warning: ignoring return value of csi_add_host', declared with attributewarn_unused_result
Thanks for your report and patch. However, I think your patch is not complete because the error route needs some additional clean up code.
Review
Quoted 8 lines
#if (
LINUX_VERSION_CODE>KERNEL_VERSION(2,5,73))(quoted diff) +6
-1- scsi_add_host (host, &PCIDEV->dev); + ret = scsi_add_host (host, &PCIDEV->dev); + if (ret) { + printk(KERN_WARNING "nsp32: scsi_add_host failed\n"); + scsi_host_put(host); + return ret; + }
How about this patch instead?
-- gotom
scsi/nsp32.c renamed from scsi/nsp32.c.gotom +8 -1
@@ -2885,12 +2885,19 @@ }#if (LINUX_VERSION_CODE >KERNEL_VERSION (2 ,5 ,73 )) -scsi_add_host (host, &PCIDEV ->dev); + ret =scsi_add_host (host, &PCIDEV ->dev); +if (ret) { +nsp32_msg (KERN_ERR ,"failed to add scsi host" ); + goto free_region; + }scsi_scan_host (host);#endif pci_set_drvdata (PCIDEV , host);return DETECT_OK ; + free_region: +release_region (host->io_port, host->n_io_port); + free_irq:free_irq (host->irq, data);