diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2010-06-17 04:17:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:02:20 -0400 |
commit | 3e2e833a547cbd0cb3fbe85a5f6ee71a93931fde (patch) | |
tree | b40daea9dca424ff8f42866b38efedab0cb9485c /drivers/scsi/mpt2sas | |
parent | f3eedd698ebafd0fe8a292672604a2db61c2c00a (diff) |
[SCSI] mpt2sas: Added -ENOMEM return type when allocation fails
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>
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 bb8acf781690..d84874492cbf 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -3634,8 +3634,10 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3634 | ioc->pd_handles_sz++; | 3634 | ioc->pd_handles_sz++; |
3635 | ioc->pd_handles = kzalloc(ioc->pd_handles_sz, | 3635 | ioc->pd_handles = kzalloc(ioc->pd_handles_sz, |
3636 | GFP_KERNEL); | 3636 | GFP_KERNEL); |
3637 | if (!ioc->pd_handles) | 3637 | if (!ioc->pd_handles) { |
3638 | r = -ENOMEM; | ||
3638 | goto out_free_resources; | 3639 | goto out_free_resources; |
3640 | } | ||
3639 | 3641 | ||
3640 | ioc->fwfault_debug = mpt2sas_fwfault_debug; | 3642 | ioc->fwfault_debug = mpt2sas_fwfault_debug; |
3641 | 3643 | ||
@@ -3676,6 +3678,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3676 | goto out_free_resources; | 3678 | goto out_free_resources; |
3677 | } | 3679 | } |
3678 | 3680 | ||
3681 | if (!ioc->base_cmds.reply || !ioc->transport_cmds.reply || | ||
3682 | !ioc->scsih_cmds.reply || !ioc->tm_cmds.reply || | ||
3683 | !ioc->config_cmds.reply || !ioc->ctl_cmds.reply) { | ||
3684 | r = -ENOMEM; | ||
3685 | goto out_free_resources; | ||
3686 | } | ||
3687 | |||
3679 | init_completion(&ioc->shost_recovery_done); | 3688 | init_completion(&ioc->shost_recovery_done); |
3680 | 3689 | ||
3681 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) | 3690 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) |