linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]Add scsi_add_host() failure handling for nsp32
@ 2006-01-10 13:11 Jesper Juhl
  2006-01-12 15:59 ` GOTO Masanori
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2006-01-10 13:11 UTC (permalink / raw)
  To: linux-scsi
  Cc: Linux Kernel Mailing List, James Bottomley, Andrew Morton,
	YOKOTA Hiroshi, GOTO Masanori, gotom

From: Jesper Juhl <jesper.juhl@gmail.com>

Add scsi_add_host() failure handling for nsp32
and silence warning.
  drivers/scsi/nsp32.c:2888: warning: ignoring return value of \x13csi_add_host', declared with attribute warn_unused_result

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 drivers/scsi/nsp32.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6.15-mm2-orig/drivers/scsi/nsp32.c	2006-01-07 14:46:18.000000000 +0100
+++ linux-2.6.15-mm2/drivers/scsi/nsp32.c	2006-01-10 14:07:00.000000000 +0100
@@ -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.

-- 
Jesper Juhl


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

* Re: [PATCH]Add scsi_add_host() failure handling for nsp32
  2006-01-10 13:11 [PATCH]Add scsi_add_host() failure handling for nsp32 Jesper Juhl
@ 2006-01-12 15:59 ` GOTO Masanori
  0 siblings, 0 replies; 2+ messages in thread
From: GOTO Masanori @ 2006-01-12 15:59 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-scsi, Linux Kernel Mailing List, James Bottomley,
	Andrew Morton, YOKOTA Hiroshi, GOTO Masanori, gotom

Dear Jesper,

At Tue, 10 Jan 2006 14:11:52 +0100,
Jesper Juhl wrote:
> Add scsi_add_host() failure handling for nsp32
> and silence warning.
>   drivers/scsi/nsp32.c:2888: warning: ignoring return value of \x13csi_add_host', declared with attribute warn_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.

>  #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;
> +	}

How about this patch instead?

-- gotom

Signed-off-by: GOTO Masanori <gotom@sanori.org>

--- drivers/scsi/nsp32.c.gotom	2006-01-13 00:41:09.000000000 +0900
+++ drivers/scsi/nsp32.c	2006-01-13 00:54:26.661567144 +0900
@@ -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);
 

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

end of thread, other threads:[~2006-01-12 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-10 13:11 [PATCH]Add scsi_add_host() failure handling for nsp32 Jesper Juhl
2006-01-12 15:59 ` GOTO Masanori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).