aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_base.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-03-17 06:56:48 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-04-11 10:24:01 -0400
commitf6aee7b9aee96ef18354f0f86e65ec635ee5039f (patch)
tree08ca58ee5ba5d6a64742467374f8a83a2b5c91e1 /drivers/scsi/mpt2sas/mpt2sas_base.c
parent8ed9a03ad4c1b6c5ae163e5e9f140852be0273a1 (diff)
[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/mpt2sas_base.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 6f786349679f..6c384dac5ec5 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)
3580 3580
3581 ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts, 3581 ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
3582 sizeof(Mpi2PortFactsReply_t), GFP_KERNEL); 3582 sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);
3583 if (!ioc->pfacts) 3583 if (!ioc->pfacts) {
3584 r = -ENOMEM;
3584 goto out_free_resources; 3585 goto out_free_resources;
3586 }
3585 3587
3586 for (i = 0 ; i < ioc->facts.NumberOfPorts; i++) { 3588 for (i = 0 ; i < ioc->facts.NumberOfPorts; i++) {
3587 r = _base_get_port_facts(ioc, i, CAN_SLEEP); 3589 r = _base_get_port_facts(ioc, i, CAN_SLEEP);
@@ -3627,6 +3629,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3627 ioc->ctl_cmds.status = MPT2_CMD_NOT_USED; 3629 ioc->ctl_cmds.status = MPT2_CMD_NOT_USED;
3628 mutex_init(&ioc->ctl_cmds.mutex); 3630 mutex_init(&ioc->ctl_cmds.mutex);
3629 3631
3632 if (!ioc->base_cmds.reply || !ioc->transport_cmds.reply ||
3633 !ioc->scsih_cmds.reply || !ioc->tm_cmds.reply ||
3634 !ioc->config_cmds.reply || !ioc->ctl_cmds.reply) {
3635 r = -ENOMEM;
3636 goto out_free_resources;
3637 }
3638
3630 init_completion(&ioc->shost_recovery_done); 3639 init_completion(&ioc->shost_recovery_done);
3631 3640
3632 for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) 3641 for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++)