From: Lukasz Luba <lukasz.luba@arm.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
kernel-janitors@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
Daniel Lezcano <daniel.lezcano@kernel.org>
Subject: Re: [PATCH] thermal: gov_power_allocator: Use common error handling code in power_allocator_bind()
Date: Mon, 7 Sep 2026 09:00:46 +0100 [thread overview]
Message-ID: <e8be7505-52a4-4c7f-9194-6e9124df6f2e@arm.com> (raw)
In-Reply-To: <a3dc82f0-7333-465d-85b4-8034b1591442@web.de>
On 6/10/26 10:30, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 10 Jun 2026 11:20:37 +0200
>
> Adjust labels so that a bit of exception handling can be better reused
> at the end of this function implementation.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/thermal/gov_power_allocator.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
> index 37f2e22a999e..6b9450ffd5de 100644
> --- a/drivers/thermal/gov_power_allocator.c
> +++ b/drivers/thermal/gov_power_allocator.c
> @@ -707,22 +707,20 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
> ret = check_power_actors(tz, params);
> if (ret < 0) {
> dev_warn(&tz->device, "power_allocator: binding failed\n");
> - kfree(params);
> - return ret;
> + goto free_params;
> }
>
> ret = allocate_actors_buffer(params, ret);
> if (ret) {
> dev_warn(&tz->device, "power_allocator: allocation failed\n");
> - kfree(params);
> - return ret;
> + goto free_params;
> }
>
> if (!tz->tzp) {
> tz->tzp = kzalloc_obj(*tz->tzp);
> if (!tz->tzp) {
> ret = -ENOMEM;
> - goto free_params;
> + goto free_power;
> }
>
> params->allocated_tzp = true;
> @@ -746,8 +744,9 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
>
> return 0;
>
> -free_params:
> +free_power:
> kfree(params->power);
> +free_params:
> kfree(params);
>
> return ret;
LGTM. BTW, I like the 'free_power' label ;)
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
next prev parent reply other threads:[~2026-09-07 8:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 9:30 Markus Elfring
2026-09-07 8:00 ` Lukasz Luba [this message]
2026-09-28 16:41 ` Daniel Lezcano
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=e8be7505-52a4-4c7f-9194-6e9124df6f2e@arm.com \
--to=lukasz.luba@arm.com \
--cc=Markus.Elfring@web.de \
--cc=daniel.lezcano@kernel.org \
--cc=kernel-janitors@vger.kernel.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®