Commit f038f391 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Jakub Kicinski

octeontx2-vf: Add missing free for alloc_percpu

Add the free_percpu for the allocated "vf->hw.lmt_info" in order to avoid
memory leak, same as the "pf->hw.lmt_info" in
`drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c`.

Fixes: 5c051207 ("octeontx2-pf: cn10k: Use runtime allocated LMTLINE region")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Acked-by: default avatarGeethasowjanya Akula <gakula@marvell.com>
Link: https://lore.kernel.org/r/20230317064337.18198-1-jiasheng@iscas.ac.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f36fa558
...@@ -709,6 +709,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -709,6 +709,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_ptp_destroy: err_ptp_destroy:
otx2_ptp_destroy(vf); otx2_ptp_destroy(vf);
err_detach_rsrc: err_detach_rsrc:
free_percpu(vf->hw.lmt_info);
if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
qmem_free(vf->dev, vf->dync_lmt); qmem_free(vf->dev, vf->dync_lmt);
otx2_detach_resources(&vf->mbox); otx2_detach_resources(&vf->mbox);
...@@ -762,6 +763,7 @@ static void otx2vf_remove(struct pci_dev *pdev) ...@@ -762,6 +763,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
otx2_shutdown_tc(vf); otx2_shutdown_tc(vf);
otx2vf_disable_mbox_intr(vf); otx2vf_disable_mbox_intr(vf);
otx2_detach_resources(&vf->mbox); otx2_detach_resources(&vf->mbox);
free_percpu(vf->hw.lmt_info);
if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
qmem_free(vf->dev, vf->dync_lmt); qmem_free(vf->dev, vf->dync_lmt);
otx2vf_vfaf_mbox_destroy(vf); otx2vf_vfaf_mbox_destroy(vf);
......
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