From: Stephen Boyd <sboyd@kernel.org>
To: hy50.seo@samsung.com, kwangwon.min@samsung.com,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
mturquette@baylibre.com, ping.gao@samsung.com
Subject: Re: [PATCH] drivers: clk:Fix parameter judgment in clk_prepare
Date: Thu, 22 Jan 2026 19:01:38 -0700 [thread overview]
Message-ID: <176913369842.4027.14623449585157677216@lazor> (raw)
In-Reply-To: <20260123013358.3801467-1-ping.gao@samsung.com>
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().
prev parent reply other threads:[~2026-01-23 2:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260123012937epcas5p4c317addca001b564606324ea1a88e393@epcas5p4.samsung.com>
2026-01-23 1:33 ` ping.gao
2026-01-23 2:01 ` Stephen Boyd [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176913369842.4027.14623449585157677216@lazor \
--to=sboyd@kernel.org \
--cc=hy50.seo@samsung.com \
--cc=kwangwon.min@samsung.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=ping.gao@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®