Re: [PATCH] clk: imx: reference preceded by free
From: Abel Vesa
Date: Tue Mar 30 2021 - 05:17:59 EST
On 21-03-23 11:10:34, Jian Dong wrote:
> From: Jian Dong <dongjian@xxxxxxxxxx>
>
> when register failed, clk will be freed, it will generate dangling pointer
> problem in later reference. it should return directly.
>
> Signed-off-by: Jian Dong <dongjian@xxxxxxxxxx>
Applied, thanks.
> ---
> drivers/clk/imx/clk-lpcg-scu.c | 1 +
> drivers/clk/imx/clk-scu.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c
> index 77be763..dd5abd0 100644
> --- a/drivers/clk/imx/clk-lpcg-scu.c
> +++ b/drivers/clk/imx/clk-lpcg-scu.c
> @@ -114,6 +114,7 @@ struct clk_hw *__imx_clk_lpcg_scu(struct device *dev, const char *name,
> if (ret) {
> kfree(clk);
> hw = ERR_PTR(ret);
> + return hw;
> }
>
> if (dev)
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 1f5518b7..f89b4da 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -426,6 +426,7 @@ struct clk_hw *__imx_clk_scu(struct device *dev, const char *name,
> if (ret) {
> kfree(clk);
> hw = ERR_PTR(ret);
> + return hw;
> }
>
> if (dev)
> --
> 1.9.1
>
>