summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-03-22 00:18:23 +0300
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-03-28 01:09:54 +0300
commit77cca462c69d827fabee0ef3fdab86109c2fe8d8 (patch)
treea8ea0755835091f612bfe47436ac4cd8489797aa
parent0feed274d2dfa2162d2c37c254eede96926d3717 (diff)
downloadlinux-77cca462c69d827fabee0ef3fdab86109c2fe8d8.tar.xz
[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>
-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)
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);