From: Stephen Boyd <sboyd@kernel.org>
To: Binbin Zhou <zhoubb.aaron@gmail.com>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>,
Huacai Chen <chenhuacai@loongson.cn>,
Michael Turquette <mturquette@baylibre.com>,
Yinbo Zhu <zhuyinbo@loongson.cn>,
Gustavo A. R. Silva <gustavoars@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
linux-clk@vger.kernel.org, Xuerui Wang <kernel@xen0n.name>,
loongarch@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH] clk: clk-loongson2: Fix the number count of clk provider
Date: Wed, 08 Jan 2025 11:20:19 -0800 [thread overview]
Message-ID: <0757e78b02165aca65465d4e96eb6e92.sboyd@kernel.org> (raw)
In-Reply-To: <CAMpQs4+i11DVGhdinMrE41HkC8hhD11P0BLeOaK5yW8QXUMX-Q@mail.gmail.com>
Quoting Binbin Zhou (2025-01-07 17:41:43)
> On Wed, Jan 8, 2025 at 5:25 AM Stephen Boyd <sboyd@kernel.org> wrote:
> > Quoting Binbin Zhou (2024-12-24 22:05:59)
> > > diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c
> > > index 6bf51d5a49a1..b1b2038acd0b 100644
> > > --- a/drivers/clk/clk-loongson2.c
> > > +++ b/drivers/clk/clk-loongson2.c
> > > @@ -294,7 +294,7 @@ static int loongson2_clk_probe(struct platform_device *pdev)
> > > return -EINVAL;
> > >
> > > for (p = data; p->name; p++)
> > > - clks_num++;
> > > + clks_num = max(clks_num, p->id + 1);
> >
> > NULL is a valid clk. Either fill the onecell data with -ENOENT error
> > pointers, or stop using it and implement a custom version of
> > of_clk_hw_onecell_get() that doesn't allow invalid clks to be requested
> > from this provider.
>
> Emm...
> Just in case, how about setting all items to ERR_PTR(-ENOENT) before
> assigning them.
> This is shown below:
>
> while (--clk_num >= 0)
> clp->clk_data.hws[clk_num] = ERR_PTR(-ENOENT);
Or something like:
memset_p(&clk->clk_data.hws, ERR_PTR(-ENOENT), clk_num);
next prev parent reply other threads:[~2025-01-08 19:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 6:05 [PATCH] clk: clk-loongson2: Fix the number count of clk provider Binbin Zhou
2025-01-07 21:25 ` Stephen Boyd
2025-01-08 1:41 ` Binbin Zhou
2025-01-08 19:20 ` Stephen Boyd [this message]
2025-01-09 3:06 ` Binbin Zhou
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=0757e78b02165aca65465d4e96eb6e92.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=gustavoars@kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-clk@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mturquette@baylibre.com \
--cc=stable@vger.kernel.org \
--cc=zhoubb.aaron@gmail.com \
--cc=zhoubinbin@loongson.cn \
--cc=zhuyinbo@loongson.cn \
/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