scsi: mpi3mr: Return error if dma_alloc_coherent() fails

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

Link: https://lore.kernel.org/r/YnOmMGHqCOtUCYQ1@kili
Fixes: 43ca110050 ("scsi: mpi3mr: Add support for PEL commands")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Dan Carpenter 2022-05-05 13:25:52 +03:00 committed by Martin K. Petersen
parent e9dedc13bb
commit bc7896d31a

View File

@ -3754,8 +3754,10 @@ retry_init:
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 @@ retry_init:
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) {