From: Uwe Kleine-König Date: Mon, 20 Jun 2022 17:18:15 +0000 (+0200) Subject: clk: Fix pointer casting to prevent oops in devm_clk_release() X-Git-Tag: baikal/aarch64/sdk5.9~28 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=51a71cbd03d15f72712bbe11af35d34918c53fdc;p=kernel.git clk: Fix pointer casting to prevent oops in devm_clk_release() commit d64a70b3b69c99cb82f93b34a09213247e20653c upstream. The release function is called with a pointer to the memory returned by devres_alloc(). I was confused about that by the code before the generalization that used a struct clk **ptr. Reported-by: Marek Szyprowski Fixes: 111eac8fbc76 ("clk: generalize devm_clk_get() a bit") Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20220620171815.114212-1-u.kleine-koenig@pengutronix.de Tested-by: Marek Szyprowski Tested-by: Linux Kernel Functional Testing Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index 43ccd20e02988..4fb4fd4b06bda 100644 --- a/drivers/clk/clk-devres.c +++ b/drivers/clk/clk-devres.c @@ -11,7 +11,7 @@ struct devm_clk_state { static void devm_clk_release(struct device *dev, void *res) { - struct devm_clk_state *state = *(struct devm_clk_state **)res; + struct devm_clk_state *state = res; if (state->exit) state->exit(state->clk);