summaryrefslogtreecommitdiff
path: root/drivers/clk/mediatek/clk-pll.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-pll.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-pll.c')
-rw-r--r--drivers/clk/mediatek/clk-pll.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c
index 817a80293bfc..ccaa2085ab4d 100644
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -394,6 +394,12 @@ int mtk_clk_register_plls(struct device_node *node,
for (i = 0; i < num_plls; i++) {
const struct mtk_pll_data *pll = &plls[i];
+ if (!IS_ERR_OR_NULL(clk_data->clks[pll->id])) {
+ pr_warn("%pOF: Trying to register duplicate clock ID: %d\n",
+ node, pll->id);
+ continue;
+ }
+
clk = mtk_clk_register_pll(pll, base);
if (IS_ERR(clk)) {