diff mbox series

scsi: mpi3mr: Return error if dma_alloc_coherent() fails

Message ID YnOmMGHqCOtUCYQ1@kili (mailing list archive)
State Accepted
Headers show
Series scsi: mpi3mr: Return error if dma_alloc_coherent() fails | expand

Commit Message

Dan Carpenter May 5, 2022, 10:25 a.m. UTC
Return -ENOMEM instead of success if dma_alloc_coherent() fails.

Fixes: 43ca11005098 ("scsi: mpi3mr: Add support for PEL commands")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Martin K. Petersen May 17, 2022, 2:09 a.m. UTC | #1
Dan,

> Return -ENOMEM instead of success if dma_alloc_coherent() fails.

Applied to 5.19/scsi-staging, thanks!
Martin K. Petersen May 20, 2022, 1:09 a.m. UTC | #2
On Thu, 5 May 2022 13:25:52 +0300, Dan Carpenter wrote:

> Return -ENOMEM instead of success if dma_alloc_coherent() fails.
> 
> 

Applied to 5.19/scsi-queue, thanks!

[1/1] scsi: mpi3mr: Return error if dma_alloc_coherent() fails
      https://git.kernel.org/mkp/scsi/c/bc7896d31a92
diff mbox series

Patch

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 74e09727a1b8..f1d4ea8ba989 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -3754,8 +3754,10 @@  int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
 		mrioc->pel_seqnum_virt = dma_alloc_coherent(&mrioc->pdev->dev,
 		    mrioc->pel_seqnum_sz, &mrioc->pel_seqnum_dma,
 		    GFP_KERNEL);
-		if (!mrioc->pel_seqnum_virt)
+		if (!mrioc->pel_seqnum_virt) {
+			retval = -ENOMEM;
 			goto out_failed_noretry;
+		}
 	}
 
 	retval = mpi3mr_enable_events(mrioc);
@@ -3873,8 +3875,10 @@  int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
 		mrioc->pel_seqnum_virt = dma_alloc_coherent(&mrioc->pdev->dev,
 		    mrioc->pel_seqnum_sz, &mrioc->pel_seqnum_dma,
 		    GFP_KERNEL);
-		if (!mrioc->pel_seqnum_virt)
+		if (!mrioc->pel_seqnum_virt) {
+			retval = -ENOMEM;
 			goto out_failed_noretry;
+		}
 	}
 
 	if (mrioc->shost->nr_hw_queues > mrioc->num_op_reply_q) {