diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2010-03-17 16:26:48 +0530 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 09:24:01 -0500 |
commit | f6aee7b9aee96ef18354f0f86e65ec635ee5039f (patch) | |
tree | 08ca58ee5ba5d6a64742467374f8a83a2b5c91e1 /drivers/scsi/mpt2sas | |
parent | 8ed9a03ad4c1b6c5ae163e5e9f140852be0273a1 (diff) | |
download | op-kernel-dev-f6aee7b9aee96ef18354f0f86e65ec635ee5039f.zip op-kernel-dev-f6aee7b9aee96ef18354f0f86e65ec635ee5039f.tar.gz |
[SCSI] mpt2sas: return -ENOMEM if memory allocation failed.
Added proper return type values in case memory allocation failed.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 6f78634..6c384da 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -3580,8 +3580,10 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts, sizeof(Mpi2PortFactsReply_t), GFP_KERNEL); - if (!ioc->pfacts) + if (!ioc->pfacts) { + r = -ENOMEM; goto out_free_resources; + } for (i = 0 ; i < ioc->facts.NumberOfPorts; i++) { r = _base_get_port_facts(ioc, i, CAN_SLEEP); @@ -3627,6 +3629,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) ioc->ctl_cmds.status = MPT2_CMD_NOT_USED; mutex_init(&ioc->ctl_cmds.mutex); + if (!ioc->base_cmds.reply || !ioc->transport_cmds.reply || + !ioc->scsih_cmds.reply || !ioc->tm_cmds.reply || + !ioc->config_cmds.reply || !ioc->ctl_cmds.reply) { + r = -ENOMEM; + goto out_free_resources; + } + init_completion(&ioc->shost_recovery_done); for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) |