[PATCH] clk: imx: reference preceded by free

Abel Vesa abel.vesa at nxp.com
Tue Mar 30 10:17:18 BST 2021


On 21-03-23 11:10:34, Jian Dong wrote:
> From: Jian Dong <dongjian at yulong.com>
> 
>  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 at yulong.com>

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
> 
> 



More information about the linux-arm-kernel mailing list