[PATCH 1/3] cpufreq: highbank: Put cpu clock if clk notifier registration fails

Zhongqiu Han zhongqiu.han at oss.qualcomm.com
Sun Nov 22 19:21:17 PST 2026


On 11/22/2026 7:55 PM, Suyuan Wang via B4 Relay wrote:
> From: Suyuan Wang <stevewong at hust.edu.cn>
> 
> hb_cpufreq_driver_init() gets the cpu0 clock with clk_get() and then
> registers a clk notifier on it. If clk_notifier_register() fails, the
> function jumps to out_put_node and returns the error, but the clock
> reference is never dropped.
> 
> Call clk_put() on that error path.
> 
> Found with a static analysis tool and checked by hand.
> 
> Fixes: 6754f556103b ("cpufreq / highbank: add support for highbank cpufreq")
> Co-developed-by: Kaixuan Li <kaixuan.li at ntu.edu.sg>
> Signed-off-by: Kaixuan Li <kaixuan.li at ntu.edu.sg>
> Signed-off-by: Suyuan Wang <stevewong at hust.edu.cn>

Reviewed-by: Zhongqiu Han <zhongqiu.han at oss.qualcomm.com>

> ---
>   drivers/cpufreq/highbank-cpufreq.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
> index a45864701143..ccdaff4384d2 100644
> --- a/drivers/cpufreq/highbank-cpufreq.c
> +++ b/drivers/cpufreq/highbank-cpufreq.c
> @@ -89,6 +89,7 @@ static int __init hb_cpufreq_driver_init(void)
>   	ret = clk_notifier_register(cpu_clk, &hb_cpufreq_clk_nb);
>   	if (ret) {
>   		pr_err("failed to register clk notifier: %d\n", ret);
> +		clk_put(cpu_clk);
>   		goto out_put_node;
>   	}
>   
> 


-- 
Thx and BRs,
Zhongqiu Han



More information about the linux-arm-kernel mailing list