diff options
author | Dan Carpenter <error27@gmail.com> | 2010-08-17 07:54:57 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-09 16:31:54 -0400 |
commit | 0caeb91c8d9ae6398bfe46ce70892e965353f613 (patch) | |
tree | 16b4173f1d8d6202091cabfccbcd8e33c385a7f9 /drivers/scsi/pm8001/pm8001_hwi.c | |
parent | e6d4ef450965af5a3753184d36ef9db7a3242950 (diff) |
[SCSI] pm8001: handle allocation failures
Return -ENOMEM if the allocations fail.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_hwi.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 9793aa6afb10..d8db0137c0c7 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -4194,6 +4194,8 @@ static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4194 | 4194 | ||
4195 | nvmd_type = ioctl_payload->minor_function; | 4195 | nvmd_type = ioctl_payload->minor_function; |
4196 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); | 4196 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); |
4197 | if (!fw_control_context) | ||
4198 | return -ENOMEM; | ||
4197 | fw_control_context->usrAddr = (u8 *)&ioctl_payload->func_specific[0]; | 4199 | fw_control_context->usrAddr = (u8 *)&ioctl_payload->func_specific[0]; |
4198 | fw_control_context->len = ioctl_payload->length; | 4200 | fw_control_context->len = ioctl_payload->length; |
4199 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4201 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
@@ -4272,6 +4274,8 @@ static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4272 | 4274 | ||
4273 | nvmd_type = ioctl_payload->minor_function; | 4275 | nvmd_type = ioctl_payload->minor_function; |
4274 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); | 4276 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); |
4277 | if (!fw_control_context) | ||
4278 | return -ENOMEM; | ||
4275 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4279 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4276 | memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, | 4280 | memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, |
4277 | ioctl_payload->func_specific, | 4281 | ioctl_payload->func_specific, |
@@ -4381,6 +4385,8 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, | |||
4381 | struct pm8001_ioctl_payload *ioctl_payload = payload; | 4385 | struct pm8001_ioctl_payload *ioctl_payload = payload; |
4382 | 4386 | ||
4383 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); | 4387 | fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); |
4388 | if (!fw_control_context) | ||
4389 | return -ENOMEM; | ||
4384 | fw_control = (struct fw_control_info *)&ioctl_payload->func_specific[0]; | 4390 | fw_control = (struct fw_control_info *)&ioctl_payload->func_specific[0]; |
4385 | if (fw_control->len != 0) { | 4391 | if (fw_control->len != 0) { |
4386 | if (pm8001_mem_alloc(pm8001_ha->pdev, | 4392 | if (pm8001_mem_alloc(pm8001_ha->pdev, |