]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup
authorChen-Yu Tsai <wenst@chromium.org>
Mon, 26 Sep 2022 10:25:18 +0000 (18:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Oct 2022 10:38:52 +0000 (12:38 +0200)
[ Upstream commit 20f7a0dba9075fb0e3d645495bc24d7025b58de1 ]

When the cleanup paths for the various clk register APIs in the MediaTek
clk library were added, the one in the dividers type used the wrong type
of unregister function. This would result in incorrect dereferencing of
the clk pointer and freeing of invalid pointers.

Fix this by switching to the correct type of clk unregistration call.

Fixes: 3c3ba2ab0226 ("clk: mediatek: mtk: Implement error handling in register APIs")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220926102523.2367530-2-wenst@chromium.org
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/mediatek/clk-mtk.c

index 05a188c6211916aaaf23d9903f8515196c8385a3..9b82956260d35bf4fe19cd750aa33b7d289bfaa1 100644 (file)
@@ -393,7 +393,7 @@ err:
                if (IS_ERR_OR_NULL(clk_data->hws[mcd->id]))
                        continue;
 
-               mtk_clk_unregister_composite(clk_data->hws[mcd->id]);
+               clk_hw_unregister_divider(clk_data->hws[mcd->id]);
                clk_data->hws[mcd->id] = ERR_PTR(-ENOENT);
        }