mailbox: mtk-cmdq: Fix local clock ID usage
authorFei Shao <fshao@chromium.org>
Thu, 14 Oct 2021 12:03:52 +0000 (20:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:35 +0000 (19:16 +0100)
commit6500e7148a01763927e346b4e2dc7e969663e45f
treeeffcab70bd6c60d5002c16e05b2c5775d282ddef
parentac2592454712e075ce58d28086d20aa984b8edb0
mailbox: mtk-cmdq: Fix local clock ID usage

[ Upstream commit 0a5ad4322927ee4aaba6facc0e4faf1ab6c0d48e ]

In the probe function, the clock IDs were pointed to local variables
which should only be used in the same code block, and any access to them
after the probing stage becomes an use-after-free case.

Since there are only limited variants of the gce clock names so far, we
can just declare them as static constants to fix the issue.

Fixes: 85dfdbfc13ea ("mailbox: cmdq: add multi-gce clocks support for mt8195")
Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mailbox/mtk-cmdq-mailbox.c