Re: [PATCH v4 2/7] OPP: Move refcount and key update for readability in _opp_table_find_key()
From: Viresh Kumar
Date: Fri Aug 22 2025 - 02:52:47 EST
On 20-08-25, 13:58, Krishna Chaitanya Chundru wrote:
> Refactor _opp_table_find_key() to improve readability by moving the
> reference count increment and key update inside the match condition block.
>
> Also make the 'assert' check mandatory instead of treating it as optional.
>
> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@xxxxxxxxxxxxxxxx>
> ---
> drivers/opp/core.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
Applied with:
@@ -554,8 +554,9 @@ static struct dev_pm_opp *_opp_table_find_key(struct opp_table *opp_table,
list_for_each_entry(temp_opp, &opp_table->opp_list, node) {
if (temp_opp->available == available) {
if (compare(&opp, temp_opp, read(temp_opp, index), *key)) {
- /* Increment the reference count of OPP */
*key = read(opp, index);
+
+ /* Increment the reference count of OPP */
dev_pm_opp_get(opp);
break;
}
--
viresh