aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/mediatek/clk-mux.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2022-02-08 20:40:34 +0800
committerStephen Boyd <sboyd@kernel.org>2022-02-17 12:12:25 -0800
commitd54bb86b89556712d92154a386b421012fecf79e (patch)
treeb76779b2ad6518cd92ad106bbac8e1012d157aa5 /drivers/clk/mediatek/clk-mux.c
parentclk: mediatek: mt8195: Implement remove functions (diff)
downloadlinux-dev-d54bb86b89556712d92154a386b421012fecf79e.tar.xz
linux-dev-d54bb86b89556712d92154a386b421012fecf79e.zip
clk: mediatek: Warn if clk IDs are duplicated
The Mediatek clk driver library handles duplicate clock IDs in two different ways: either ignoring the duplicate entry, or overwriting the old clk. Either way may cause unexpected behavior, and the latter also causes an orphan clk that cannot be cleaned up. Align the behavior so that later duplicate entries are ignored, and a warning printed. The warning will also aid in making the issue noticeable. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Miles Chen <miles.chen@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220208124034.414635-32-wenst@chromium.org Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/mediatek/clk-mux.c')
-rw-r--r--drivers/clk/mediatek/clk-mux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/clk/mediatek/clk-mux.c b/drivers/clk/mediatek/clk-mux.c
index f51e67650f03..21ad5a4afd65 100644
--- a/drivers/clk/mediatek/clk-mux.c
+++ b/drivers/clk/mediatek/clk-mux.c
@@ -208,8 +208,11 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes,
for (i = 0; i < num; i++) {
const struct mtk_mux *mux = &muxes[i];
- if (!IS_ERR_OR_NULL(clk_data->clks[mux->id]))
+ if (!IS_ERR_OR_NULL(clk_data->clks[mux->id])) {
+ pr_warn("%pOF: Trying to register duplicate clock ID: %d\n",
+ node, mux->id);
continue;
+ }
clk = mtk_clk_register_mux(mux, regmap, lock);