Skip to content

Commit

Permalink
[SCSI] mpt2sas: Added -ENOMEM return type when allocation fails
Browse files Browse the repository at this point in the history
In the driver mpt2sas_base_attach subroutine, we need to add
support to return the proper error code when there are memory allocation
failures, e.g. returning -ENOMEM.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Kashyap, Desai authored and James Bottomley committed Jul 27, 2010
1 parent f3eedd6 commit 3e2e833
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/scsi/mpt2sas/mpt2sas_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3634,8 +3634,10 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
ioc->pd_handles_sz++;
ioc->pd_handles = kzalloc(ioc->pd_handles_sz,
GFP_KERNEL);
if (!ioc->pd_handles)
if (!ioc->pd_handles) {
r = -ENOMEM;
goto out_free_resources;
}

ioc->fwfault_debug = mpt2sas_fwfault_debug;

Expand Down Expand Up @@ -3676,6 +3678,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
goto out_free_resources;
}

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++)
Expand Down

0 comments on commit 3e2e833

Please sign in to comment.