mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Viresh Kumar <viresh.kumar@linaro.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>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] OPP: Use mutex locking guards
Date: Sun, 22 Feb 2026 18:01:28 -0600	[thread overview]
Message-ID: <b1d73d74-ab1c-4cb6-89c0-20444ac02c4c@baylibre.com> (raw)
In-Reply-To: <cb4bdf07e512e39af4c9142679c1361ce76e9336.1745490980.git.viresh.kumar@linaro.org>

On 4/24/25 5:36 AM, Viresh Kumar wrote:
> Use mutex locking guard in the OPP core.
> 
> No intentional functional impact.

There is an unintentional functional change here.

> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---

...

> @@ -2660,17 +2632,16 @@ struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_table *src_table,
>  		return ERR_PTR(-EBUSY);
>  
>  	for (i = 0; i < src_table->required_opp_count; i++) {
> -		if (src_table->required_opp_tables[i] == dst_table) {
> -			mutex_lock(&src_table->lock);
> +		if (src_table->required_opp_tables[i] != dst_table)
> +			continue;
>  
> +		scoped_guard(mutex, &src_table->lock) {
>  			list_for_each_entry(opp, &src_table->opp_list, node) {
>  				if (opp == src_opp) {
>  					dest_opp = dev_pm_opp_get(opp->required_opps[i]);
>  					break;
>  				}
>  			}
> -
> -			mutex_unlock(&src_table->lock);
>  			break;
>  		}
>  	}

scoped_guard() is implemented as a for loop. So now this break statement
breaks out out the scoped_guard() and not out of the outer for loop. Now
the outer loop always iterates to completion.

Assuming each item in src_table->required_opp_tables is unique, this doesn't
look like a bug. Rather it is just doing unnecessary extra iterations.

To preserve the logic, the break should be moved out of the scoped_guard().


      reply	other threads:[~2026-02-23  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 10:36 [PATCH 0/6] OPP: Scope based cleanup helpers and lock guards Viresh Kumar
2025-04-24 10:36 ` [PATCH 1/6] OPP: Remove _get_opp_table_kref() Viresh Kumar
2025-04-24 10:36 ` [PATCH 2/6] OPP: Return opp from dev_pm_opp_get() Viresh Kumar
2025-04-24 10:36 ` [PATCH 3/6] OPP: Return opp_table from dev_pm_opp_get_opp_table_ref() Viresh Kumar
2025-04-24 10:36 ` [PATCH 4/6] OPP: Use scope-based OF cleanup helpers Viresh Kumar
2025-04-24 10:36 ` [PATCH 5/6] OPP: Define and use scope-based " Viresh Kumar
2025-04-24 10:36 ` [PATCH 6/6] OPP: Use mutex locking guards Viresh Kumar
2026-02-23  0:01   ` David Lechner [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=b1d73d74-ab1c-4cb6-89c0-20444ac02c4c@baylibre.com \
    --to=dlechner@baylibre.com \
    --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®