aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hosts.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-03-21 17:18:23 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-03-27 18:09:54 -0400
commit77cca462c69d827fabee0ef3fdab86109c2fe8d8 (patch)
treea8ea0755835091f612bfe47436ac4cd8489797aa /drivers/scsi/hosts.c
parent0feed274d2dfa2162d2c37c254eede96926d3717 (diff)
[SCSI] hosts.c: fixes for "no error" reported after error scenarios
This patch corrects some cases in scsi_add_host() that fail, but the "error" return code was not reset after a prior use which set it to a non-error value. Patch cut against scsi-rc-fixes-2.6 Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/hosts.c')
-rw-r--r--drivers/scsi/hosts.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 880c78bff0e1..ed7e0a1fc34d 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -218,18 +218,24 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
218 218
219 get_device(&shost->shost_gendev); 219 get_device(&shost->shost_gendev);
220 220
221 if (shost->transportt->host_size && 221 if (shost->transportt->host_size) {
222 (shost->shost_data = kzalloc(shost->transportt->host_size, 222 shost->shost_data = kzalloc(shost->transportt->host_size,
223 GFP_KERNEL)) == NULL) 223 GFP_KERNEL);
224 goto out_del_classdev; 224 if (shost->shost_data == NULL) {
225 error = -ENOMEM;
226 goto out_del_classdev;
227 }
228 }
225 229
226 if (shost->transportt->create_work_queue) { 230 if (shost->transportt->create_work_queue) {
227 snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d", 231 snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d",
228 shost->host_no); 232 shost->host_no);
229 shost->work_q = create_singlethread_workqueue( 233 shost->work_q = create_singlethread_workqueue(
230 shost->work_q_name); 234 shost->work_q_name);
231 if (!shost->work_q) 235 if (!shost->work_q) {
236 error = -EINVAL;
232 goto out_free_shost_data; 237 goto out_free_shost_data;
238 }
233 } 239 }
234 240
235 error = scsi_sysfs_add_host(shost); 241 error = scsi_sysfs_add_host(shost);