Re: Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu

From: Jiasheng Jiang <hidden>
Date: 2023-03-17 06:34:40
Also in: lkml

On Fri, Mar 17, 2023 at 12:24:46AM +0800, Jakub Kicinski wrote:
On Thu, 16 Mar 2023 10:39:11 +0800 Jiasheng Jiang wrote:
quoted
+	if (vf->hw.lmt_info)
+		free_percpu(vf->hw.lmt_info);
 	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
 		qmem_free(vf->dev, vf->dync_lmt);
 	otx2_detach_resources(&vf->mbox);
@@ -762,6 +764,8 @@ static void otx2vf_remove(struct pci_dev *pdev)
 	otx2_shutdown_tc(vf);
 	otx2vf_disable_mbox_intr(vf);
 	otx2_detach_resources(&vf->mbox);
+	if (vf->hw.lmt_info)
+		free_percpu(vf->hw.lmt_info);
No need for the if () checks, free_percpu() seems to handle NULL just
fine.
I will submit a v2 removing the checks.

Thanks,
Jiang
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help