clk: mediatek: clk-mtk: Grab iomem pointer for divider clocks
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 15 Jun 2023 12:20:49 +0000 (14:20 +0200)
committerStephen Boyd <sboyd@kernel.org>
Fri, 16 Jun 2023 19:20:25 +0000 (12:20 -0700)
commit51821765e89906090753421580a61d25a4668186
tree99c966510bdafed461d58154087d38aba8f032b7
parent3db7285e044144fd88a356f5b641b9cd4b231a77
clk: mediatek: clk-mtk: Grab iomem pointer for divider clocks

In the rare case in which one of the clock drivers has divider clocks
but not composite clocks, mtk_clk_simple_probe() would not io(re)map,
hence passing a NULL pointer to mtk_clk_register_dividers().

To fix this issue, extend the `if` conditional to also check if any
divider clocks are present. While at it, also make sure the iomem
pointer is NULL if no composite/divider clocks are declared, as we
are checking for that when iounmapping it in the error path.

This hasn't been seen on any MediaTek clock driver as the current ones
always declare composite clocks along with divider clocks, but this is
still an important fix for a future potential KP.

Fixes: 1fe074b1f112 ("clk: mediatek: Add divider clocks to mtk_clk_simple_{probe,remove}()")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230615122051.546985-2-angelogioacchino.delregno@collabora.com
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mtk.c