Commit c7983044 authored by Tomas Henzl's avatar Tomas Henzl Committed by Martin K. Petersen

scsi: mpi3mr: Fix memory leaks in mpi3mr_init_ioc()

Don't allocate memory again when IOC is being reinitialized.

Fixes: fe6db615 ("scsi: mpi3mr: Handle offline FW activation in graceful manner")
Signed-off-by: default avatarTomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20230302234336.25456-6-thenzl@redhat.comAcked-by: default avatarSathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d4caa1a4
......@@ -3837,29 +3837,34 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
mpi3mr_print_ioc_info(mrioc);
dprint_init(mrioc, "allocating config page buffers\n");
mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
MPI3MR_DEFAULT_CFG_PAGE_SZ, &mrioc->cfg_page_dma, GFP_KERNEL);
if (!mrioc->cfg_page) {
retval = -1;
goto out_failed_noretry;
dprint_init(mrioc, "allocating config page buffers\n");
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL);
if (!mrioc->cfg_page) {
retval = -1;
goto out_failed_noretry;
}
}
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
if (retval) {
ioc_err(mrioc,
"%s :Failed to allocated reply sense buffers %d\n",
__func__, retval);
goto out_failed_noretry;
if (!mrioc->init_cmds.reply) {
retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
if (retval) {
ioc_err(mrioc,
"%s :Failed to allocated reply sense buffers %d\n",
__func__, retval);
goto out_failed_noretry;
}
}
retval = mpi3mr_alloc_chain_bufs(mrioc);
if (retval) {
ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
retval);
goto out_failed_noretry;
if (!mrioc->chain_sgl_list) {
retval = mpi3mr_alloc_chain_bufs(mrioc);
if (retval) {
ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
retval);
goto out_failed_noretry;
}
}
retval = mpi3mr_issue_iocinit(mrioc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment