[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176913369842.4027.14623449585157677216@lazor>
Date: Thu, 22 Jan 2026 19:01:38 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: hy50.seo@...sung.com, kwangwon.min@...sung.com, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, mturquette@...libre.com, ping.gao@...sung.com
Subject: Re: [PATCH] drivers: clk:Fix parameter judgment in clk_prepare
Quoting ping.gao (2026-01-22 18:33:58)
> The clk may return NULL or an ERR_PTR. Don't
> treat an ERR_PTR as valid.
>
> for example: biu_clk in dwmmc driver request fail, but it's ERR_PTR,
> not null,it will panic when call clk_prepare
[...]
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 85d2f2481acf..6d62f69323b5 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1171,7 +1171,7 @@ static int clk_core_prepare_lock(struct clk_core *core)
> */
> int clk_prepare(struct clk *clk)
> {
> - if (!clk)
> + if (IS_ERR_OR_NULL(clk))
Don't pass an error pointer to this function. You should have checked
that when getting the clk with something like clk_get().
Powered by blists - more mailing lists