From: Geethasowjanya Akula <gakula@marvell.com>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: Sunil Kovvuri Goutham <sgoutham@marvell.com>,
Subbaraya Sundeep Bhatta <sbhatta@marvell.com>,
Hariprasad Kelam <hkelam@marvell.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"richardcochran@gmail.com" <richardcochran@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [EXT] Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu
Date: Thu, 16 Mar 2023 09:00:57 +0000 [thread overview]
Message-ID: <DM6PR18MB2602F8A77B07FFDC1F2B07A4CDBC9@DM6PR18MB2602.namprd18.prod.outlook.com> (raw)
In-Reply-To: <ZBLO3FSC4IhoBzl1@localhost.localdomain>
>-----Original Message-----
>From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>Sent: Thursday, March 16, 2023 1:40 PM
>To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
>Cc: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Geethasowjanya Akula <gakula@marvell.com>; Subbaraya Sundeep Bhatta <sbhatta@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>; >davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; richardcochran@gmail.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [EXT] Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu
>External Email
>----------------------------------------------------------------------
>On Thu, Mar 16, 2023 at 10:39:11AM +0800, Jiasheng Jiang wrote:
>> 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: 5c0512072f65 ("octeontx2-pf: cn10k: Use runtime allocated
>> LMTLINE region")
>> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
>> ---
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> index 7f8ffbf79cf7..9db2e2d218bb 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> @@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev,
>> const struct pci_device_id *id)
>> err_ptp_destroy:
>> otx2_ptp_destroy(vf);
>> err_detach_rsrc:
>> + 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);
>I wonder if it wouldn't be more error prune when You create a function to unroll cn10k_lmtst_init() like cn10k_lmtst_deinit(). These two if can be there, maybe also sth else is missing.
>Otherwise it is fine
>Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>> 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);
Ack. Thanks for the patch.
>> if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
>> qmem_free(vf->dev, vf->dync_lmt);
>> otx2vf_vfaf_mbox_destroy(vf);
>> --
>> 2.25.1
>>
Geetha.
next prev parent reply other threads:[~2023-03-16 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 2:39 Jiasheng Jiang
2023-03-16 8:10 ` Michal Swiatkowski
2023-03-16 9:00 ` Geethasowjanya Akula [this message]
2023-03-17 4:24 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR18MB2602F8A77B07FFDC1F2B07A4CDBC9@DM6PR18MB2602.namprd18.prod.outlook.com \
--to=gakula@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkelam@marvell.com \
--cc=jiasheng@iscas.ac.cn \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®