diff options
author | Chen-Yu Tsai <wenst@chromium.org> | 2022-02-08 20:40:34 +0800 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-02-17 12:12:25 -0800 |
commit | d54bb86b89556712d92154a386b421012fecf79e (patch) | |
tree | b76779b2ad6518cd92ad106bbac8e1012d157aa5 /drivers/clk/mediatek/clk-pll.c | |
parent | cf8a482afc286dde5eaf4a08d12b63590c599764 (diff) | |
download | lwn-d54bb86b89556712d92154a386b421012fecf79e.tar.gz lwn-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-pll.c')
-rw-r--r-- | drivers/clk/mediatek/clk-pll.c | 6 |
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)) { |