summaryrefslogtreecommitdiff
path: root/drivers/clk/mediatek/clk-gate.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2022-02-08 15:40:34 +0300
committerStephen Boyd <sboyd@kernel.org>2022-02-17 23:12:25 +0300
commitd54bb86b89556712d92154a386b421012fecf79e (patch)
treeb76779b2ad6518cd92ad106bbac8e1012d157aa5 /drivers/clk/mediatek/clk-gate.c
parentcf8a482afc286dde5eaf4a08d12b63590c599764 (diff)
downloadlinux-d54bb86b89556712d92154a386b421012fecf79e.tar.xz
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-gate.c')
-rw-r--r--drivers/clk/mediatek/clk-gate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
index 631ff170b7b9..da52023f8455 100644
--- a/drivers/clk/mediatek/clk-gate.c
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -224,8 +224,11 @@ int mtk_clk_register_gates_with_dev(struct device_node *node,
for (i = 0; i < num; i++) {
const struct mtk_gate *gate = &clks[i];
- if (!IS_ERR_OR_NULL(clk_data->clks[gate->id]))
+ if (!IS_ERR_OR_NULL(clk_data->clks[gate->id])) {
+ pr_warn("%pOF: Trying to register duplicate clock ID: %d\n",
+ node, gate->id);
continue;
+ }
clk = mtk_clk_register_gate(gate->name, gate->parent_name,
regmap,