From: "J, KEERTHY" <j-keerthy@ti.com>
To: Bryan Brattlof <bb@ti.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] thermal: k3_j72xx_bandgap: Fix ref_table memory leak during probe
Date: Thu, 26 May 2022 20:28:54 +0530 [thread overview]
Message-ID: <069ce949-bc78-7bfa-686c-ba3f72c7e431@ti.com> (raw)
In-Reply-To: <20220525213617.30002-1-bb@ti.com>
On 5/26/2022 3:06 AM, Bryan Brattlof wrote:
> If an error occurs in the k3_j72xx_bandgap_probe() function the memory
> allocated to the 'ref_table' will not be released.
>
> Add a err_free_ref_table step to the error path to free 'ref_table'
Reviewed-by: Keerthy <j-keerthy@ti.com>
>
> Fixes: 72b3fc61c752 ("thermal: k3_j72xx_bandgap: Add the bandgap driver support")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Bryan Brattlof <bb@ti.com>
> ---
> drivers/thermal/k3_j72xx_bandgap.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
> index 64e3231589527..3a35aa38ff512 100644
> --- a/drivers/thermal/k3_j72xx_bandgap.c
> +++ b/drivers/thermal/k3_j72xx_bandgap.c
> @@ -433,7 +433,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (!derived_table) {
> ret = -ENOMEM;
> - goto err_alloc;
> + goto err_free_ref_table;
> }
>
> /* Workaround not needed if bit30/bit31 is set even for J721e */
> @@ -483,7 +483,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
> if (IS_ERR(ti_thermal)) {
> dev_err(bgp->dev, "thermal zone device is NULL\n");
> ret = PTR_ERR(ti_thermal);
> - goto err_alloc;
> + goto err_free_ref_table;
> }
> }
>
> @@ -514,6 +514,9 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
>
> return 0;
>
> +err_free_ref_table:
> + kfree(ref_table);
> +
> err_alloc:
> pm_runtime_put_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
prev parent reply other threads:[~2022-05-26 14:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 21:36 Bryan Brattlof
2022-05-26 14:58 ` J, KEERTHY [this message]
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=069ce949-bc78-7bfa-686c-ba3f72c7e431@ti.com \
--to=j-keerthy@ti.com \
--cc=amitk@kernel.org \
--cc=bb@ti.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.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®