[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211215091623.GA15796@amd>
Date: Wed, 15 Dec 2021 10:16:24 +0100
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Stephen Boyd <sboyd@...nel.org>
Subject: Re: [PATCH 4.19 29/74] clk: qcom: regmap-mux: fix parent clock lookup
Hi!
> The function mux_get_parent() uses qcom_find_src_index() to find the
> parent clock index, which is incorrect: qcom_find_src_index() uses src
> enum for the lookup, while mux_get_parent() should use cfg field (which
> corresponds to the register value). Add qcom_find_cfg_index() function
> doing this kind of lookup and use it for mux parent lookup.
This appears to have problems with error handling.
> +++ b/drivers/clk/qcom/clk-regmap-mux.c
> @@ -36,7 +36,7 @@ static u8 mux_get_parent(struct clk_hw *
> val &= mask;
>
> if (mux->parent_map)
> - return qcom_find_src_index(hw, mux->parent_map, val);
> + return qcom_find_cfg_index(hw, mux->parent_map, val);
>
> return val;
> }
So this returns u8.
> +int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg)
> +{
> + int i, num_parents = clk_hw_get_num_parents(hw);
> +
> + for (i = 0; i < num_parents; i++)
> + if (cfg == map[i].cfg)
> + return i;
> +
> + return -ENOENT;
> +}
In case of error, -ENOENT will be cast to u8 in caller. I don't
believe that is correct.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists