From: Conor Dooley <conor@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Conor Dooley <conor.dooley@microchip.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings
Date: Wed, 4 Jan 2023 13:40:04 +0000 [thread overview]
Message-ID: <Y7WBtMmLzYvk60tD@spud> (raw)
In-Reply-To: <CAMuHMdX--sfenmb7WMgpe5045YfR7UjXAM-T9ZNZO3eTN_R=bg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]
On Wed, Jan 04, 2023 at 02:26:53PM +0100, Geert Uytterhoeven wrote:
> Hi Conor,
>
> On Tue, Jan 3, 2023 at 6:32 PM Conor Dooley <conor@kernel.org> wrote:
> > I half wonder if this should actually have a fixes tag too. Since it
> > used what came after the @ in $full_name, it'd be possible to create
> > (an incorrect) DTS that would lead to a clash between pll names &
> > therefore probe would fail.
> > The tag would be:
> > Fixes: d39fb172760e ("clk: microchip: add PolarFire SoC fabric clock support")
>
> But I don't change any of that in my patch?
> /me confused.
The numbers in there were chosen to fit exactly what is in mpfs.dtsi
(IOW the correct node address), so doing
@@ -201,14 +200,13 @@ static int mpfs_ccc_register_plls(struct device *dev, struct mpfs_ccc_pll_hw_clo
for (unsigned int i = 0; i < num_clks; i++) {
struct mpfs_ccc_pll_hw_clock *pll_hw = &pll_hws[i];
- char *name = devm_kzalloc(dev, 18, GFP_KERNEL);
- if (!name)
+ pll_hw->name = devm_kasprintf(dev, GFP_KERNEL, "ccc%s_pll%u",
+ strchrnul(dev->of_node->full_name, '@'), i);
+ if (!pll_hw->name)
return -ENOMEM;
pll_hw->base = data->pll_base[i];
- snprintf(name, 18, "ccc%s_pll%u", strchrnul(dev->of_node->full_name, '@'), i);
- pll_hw->name = (const char *)name;
pll_hw->hw.init = CLK_HW_INIT_PARENTS_DATA_FIXED_SIZE(pll_hw->name,
pll_hw->parents,
&mpfs_ccc_pll_ops, 0);
means that we no longer have to worry that someone would provide a
device tree with a node address that would make "ccc<node_address>_pll<N>"
exceed 18 characters. If that happened, the <N> would be cut off & both
pll 0 & 1 would be named identically. If that happens, pll1 would fail
to register.
Or am I misunderstanding something? Probably am..
Thanks,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-01-04 13:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 16:45 [PATCH] clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings Geert Uytterhoeven
2023-01-03 17:32 ` Conor Dooley
2023-01-04 13:26 ` Geert Uytterhoeven
2023-01-04 13:40 ` Conor Dooley [this message]
2023-01-04 13:44 ` Geert Uytterhoeven
2023-01-11 19:26 ` Conor Dooley
2023-01-12 8:52 ` Claudiu.Beznea
2023-01-12 10:04 ` Claudiu.Beznea
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=Y7WBtMmLzYvk60tD@spud \
--to=conor@kernel.org \
--cc=claudiu.beznea@microchip.com \
--cc=conor.dooley@microchip.com \
--cc=geert@linux-m68k.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.