aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorNikola Pajkovsky2017-08-29 13:59:04 +0200
committerMartin K. Petersen2017-08-30 22:02:23 -0400
commit96676246981b8321fb7bcaf51147f3be7c436af5 (patch)
tree9468827c93f7a43ab6050b2d9bb67adc7a7139ab /drivers/scsi
parenta226032398cb03760c7a36e6be39ded86845a6cd (diff)
scsi: aacraid: report -ENOMEM to upper layer from aac_convert_sgraw2()
aac_convert_sgraw2() kmalloc memory and return -1 on error, which should be -ENOMEM. However, nobody is checking return value, so with this change, -ENOMEM is propagated to upper layer. Signed-off-by: Nikola Pajkovsky <npajkovsky@suse.cz> Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aacraid/aachba.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 1943a48be3f3..a6619b8f48d9 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -3950,8 +3950,12 @@ static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
if (!err_found)
break;
}
- if (i > 0 && nseg_new <= sg_max)
- aac_convert_sgraw2(rio2, i, nseg, nseg_new);
+ if (i > 0 && nseg_new <= sg_max) {
+ int ret = aac_convert_sgraw2(rio2, i, nseg, nseg_new);
+
+ if (ret < 0)
+ return ret;
+ }
} else
rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT);
@@ -3975,7 +3979,7 @@ static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int
sge = kmalloc(nseg_new * sizeof(struct sge_ieee1212), GFP_ATOMIC);
if (sge == NULL)
- return -1;
+ return -ENOMEM;
for (i = 1, pos = 1; i < nseg-1; ++i) {
for (j = 0; j < rio2->sge[i].length / (pages * PAGE_SIZE); ++j) {