[PATCH 2/2] scsi/pcmcia/nsp_cs.c: Handle scsi_add_host failure

From: Ashutosh Naik
Date: Wed Jan 11 2006 - 04:39:14 EST


Add scsi_add_host() failure handling for the NinjaSCSI-3 /
NinjaSCSI-32Bi PCMCIA SCSI host adapter card driver

Signed-off-by: Ashutosh Naik <ashutosh.naik@xxxxxxxxx>
diff -Naurp linux-2.6.15-git6-vanilla/drivers/scsi/pcmcia/nsp_cs.c linux-2.6.15-git6/drivers/scsi/pcmcia/nsp_cs.c
--- linux-2.6.15-git6-vanilla/drivers/scsi/pcmcia/nsp_cs.c 2006-01-11 12:56:56.000000000 +0530
+++ linux-2.6.15-git6/drivers/scsi/pcmcia/nsp_cs.c 2006-01-11 12:51:34.000000000 +0530
@@ -1678,7 +1678,7 @@ static void nsp_cs_config(dev_link_t *li
scsi_info_t *info = link->priv;
tuple_t tuple;
cisparse_t parse;
- int last_ret, last_fn;
+ int last_ret, last_fn, retval;
unsigned char tuple_data[64];
config_info_t conf;
win_req_t req;
@@ -1854,7 +1854,13 @@ static void nsp_cs_config(dev_link_t *li


#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74))
- scsi_add_host (host, NULL);
+ retval = scsi_add_host (host, NULL);
+ if (retval) {
+ printk(KERN_WARNING "nsp_cs: scsi_add_host failed\n");
+ scsi_host_put(host);
+ return retval;
+ }
+
scsi_scan_host(host);

snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no);