mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki"	 <rafael@kernel.org>,
	Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	 Stephen Boyd <sboyd@kernel.org>
Cc: linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	 Dan Carpenter <dan.carpenter@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] OPP: Initialize scope-based pointers inline
Date: Wed, 22 Oct 2025 06:37:15 -0700	[thread overview]
Message-ID: <703531ba0d3183ffc77e5a76922099564848091e.camel@perches.com> (raw)
In-Reply-To: <45a64ff434a027c296d1d5c35f442e51378c9425.1761128347.git.viresh.kumar@linaro.org>

On Wed, 2025-10-22 at 15:49 +0530, Viresh Kumar wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behaviour as the memory allocated to the pointer is freed automatically
> when the pointer goes out of scope.
[]
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
[]
> @@ -309,9 +309,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_is_turbo);
>   */
>  unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
>  {
> -	struct opp_table *opp_table __free(put_opp_table);
> -
> -	opp_table = _find_opp_table(dev);
> +	struct opp_table *opp_table __free(put_opp_table) =
> +		_find_opp_table(dev);

Style trivia:

It's common to include a blank line after the definitions.

> @@ -327,7 +326,6 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
>   */
>  unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
>  {
> -	struct opp_table *opp_table __free(put_opp_table);
>  	struct dev_pm_opp *opp;
>  	struct regulator *reg;
>  	unsigned long latency_ns = 0;
> @@ -337,7 +335,8 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
>  		unsigned long max;
>  	} *uV;
>  
> -	opp_table = _find_opp_table(dev);
> +	struct opp_table *opp_table __free(put_opp_table) =
> +		_find_opp_table(dev);

here too etc...

>  	if (IS_ERR(opp_table))
>  		return 0;
>  

      reply	other threads:[~2025-10-22 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 10:19 Viresh Kumar
2025-10-22 13:37 ` Joe Perches [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=703531ba0d3183ffc77e5a76922099564848091e.camel@perches.com \
    --to=joe@perches.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=rafael@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    /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®