Skip to content

Commit

Permalink
[SCSI] hosts.c: fixes for "no error" reported after error scenarios
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Smart authored and James Bottomley committed Mar 27, 2008
1 parent 0feed27 commit 77cca46
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,24 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)

get_device(&shost->shost_gendev);

if (shost->transportt->host_size &&
(shost->shost_data = kzalloc(shost->transportt->host_size,
GFP_KERNEL)) == NULL)
goto out_del_classdev;
if (shost->transportt->host_size) {
shost->shost_data = kzalloc(shost->transportt->host_size,
GFP_KERNEL);
if (shost->shost_data == NULL) {
error = -ENOMEM;
goto out_del_classdev;
}
}

if (shost->transportt->create_work_queue) {
snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d",
shost->host_no);
shost->work_q = create_singlethread_workqueue(
shost->work_q_name);
if (!shost->work_q)
if (!shost->work_q) {
error = -EINVAL;
goto out_free_shost_data;
}
}

error = scsi_sysfs_add_host(shost);
Expand Down

0 comments on commit 77cca46

Please sign in to comment.