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,16 +3837,18 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) ...@@ -3837,16 +3837,18 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
mpi3mr_print_ioc_info(mrioc); mpi3mr_print_ioc_info(mrioc);
if (!mrioc->cfg_page) {
dprint_init(mrioc, "allocating config page buffers\n"); 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 = dma_alloc_coherent(&mrioc->pdev->dev,
MPI3MR_DEFAULT_CFG_PAGE_SZ, &mrioc->cfg_page_dma, GFP_KERNEL); mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL);
if (!mrioc->cfg_page) { if (!mrioc->cfg_page) {
retval = -1; retval = -1;
goto out_failed_noretry; goto out_failed_noretry;
} }
}
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ; if (!mrioc->init_cmds.reply) {
retval = mpi3mr_alloc_reply_sense_bufs(mrioc); retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
if (retval) { if (retval) {
ioc_err(mrioc, ioc_err(mrioc,
...@@ -3854,13 +3856,16 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) ...@@ -3854,13 +3856,16 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
__func__, retval); __func__, retval);
goto out_failed_noretry; goto out_failed_noretry;
} }
}
if (!mrioc->chain_sgl_list) {
retval = mpi3mr_alloc_chain_bufs(mrioc); retval = mpi3mr_alloc_chain_bufs(mrioc);
if (retval) { if (retval) {
ioc_err(mrioc, "Failed to allocated chain buffers %d\n", ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
retval); retval);
goto out_failed_noretry; goto out_failed_noretry;
} }
}
retval = mpi3mr_issue_iocinit(mrioc); retval = mpi3mr_issue_iocinit(mrioc);
if (retval) { if (retval) {
......
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