From: Guenter Roeck <linux@roeck-us.net>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
Duanqiang Wen <duanqiangwen@net-swift.com>,
mturquette@baylibre.com, sboyd@kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clkdev: report over-sized strings when creating clkdev entries
Date: Fri, 17 May 2024 16:34:06 -0700 [thread overview]
Message-ID: <4ea9cc83-c7ca-47b8-8d43-dab16193108f@roeck-us.net> (raw)
In-Reply-To: <ZkfYqj+OcAxd9O2t@shell.armlinux.org.uk>
On 5/17/24 15:22, Russell King (Oracle) wrote:
> On Fri, May 17, 2024 at 03:09:12PM -0700, Guenter Roeck wrote:
>> Hi,
>>
>> On Fri, Mar 15, 2024 at 11:47:55AM +0000, Russell King (Oracle) wrote:
>>> Report an error when an attempt to register a clkdev entry results in a
>>> truncated string so the problem can be easily spotted.
>>>
>>> Reported by: Duanqiang Wen <duanqiangwen@net-swift.com>
>>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>>> Reviewed-by: Stephen Boyd <sboyd@kernel.org>
>>
>> With this patch in the mainline kernel, I get
>>
>> 10000000.clock-controller:corepll: device ID is greater than 24
>> sifive-clk-prci 10000000.clock-controller: Failed to register clkdev for corepll: -12
>> sifive-clk-prci 10000000.clock-controller: could not register clocks: -12
>> sifive-clk-prci 10000000.clock-controller: probe with driver sifive-clk-prci failed with error -12
>> ...
>> platform 10060000.gpio: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>> platform 10010000.serial: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>> platform 10011000.serial: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>> platform 10040000.spi: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>> platform 10050000.spi: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>> platform 10090000.ethernet: deferred probe pending: platform: supplier 10000000.clock-controller not ready
>>
>> when trying to boot sifive_u in qemu.
>>
>> Apparently, "10000000.clock-controller" is too long. Any suggestion on
>> how to solve the problem ? I guess using dev_name(dev) as dev_id parameter
>> for clk_hw_register_clkdev() is not or no longer a good idea.
>> What else should be used instead ?
>
> It was *never* a good idea. clkdev uses a fixed buffer size of 20
> characters including the NUL character, and "10000000.clock-controller"
> would have been silently truncated to "10000000.clock-cont", and thus
>
> if (!dev_id || strcmp(p->dev_id, dev_id))
>
> would never have matched.
>
> We need to think about (a) whether your use of clk_hw_register_clkdev()
> is still appropriate, and (b) whether we need to increase the size of
> the strings.
>
It isn't _my_ use, really. I only run a variety of boot tests with qemu.
I expect we'll see reports from others trying to boot the mainline kernel
on real sifive_u hardware or other hardware using the same driver or other
drivers using dev_name() as dev_id parameter. Coccinelle finds the
following callers:
./sound/soc/codecs/rt5682s.c: dev_name() used as dev_id at line 2833
./drivers/clk/sifive/sifive-prci.c: dev_name() used as dev_id at line 540
./sound/soc/codecs/tlv320aic32x4-clk.c: dev_name() used as dev_id at line 475
./drivers/i2c/busses/i2c-bcm2835.c: dev_name() used as dev_id at line 189
./sound/soc/codecs/rt5682.c: dev_name() used as dev_id at line 2909
Guenter
next prev parent reply other threads:[~2024-05-17 23:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 11:47 [PATCH] clkdev: report over-sized strings when creating clkdev entries Russell King (Oracle)
2024-04-08 3:48 ` Stephen Boyd
2024-05-02 0:59 ` Stephen Boyd
2024-05-02 1:02 ` Stephen Boyd
2024-05-02 8:02 ` Russell King (Oracle)
2024-05-02 8:22 ` Russell King (Oracle)
2024-05-02 11:08 ` Russell King (Oracle)
2024-05-02 22:18 ` Stephen Boyd
2024-05-17 22:09 ` Guenter Roeck
2024-05-17 22:22 ` Russell King (Oracle)
2024-05-17 23:34 ` Guenter Roeck [this message]
2024-05-17 23:37 ` Russell King (Oracle)
2024-05-18 3:24 ` Guenter Roeck
2024-05-18 7:01 ` Russell King (Oracle)
2024-05-22 6:53 ` Linux regression tracking (Thorsten Leemhuis)
2024-05-22 9:34 ` Russell King (Oracle)
2024-05-22 9:37 ` Russell King (Oracle)
2024-05-22 21:32 ` Guenter Roeck
2024-05-18 13:44 ` Guenter Roeck
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=4ea9cc83-c7ca-47b8-8d43-dab16193108f@roeck-us.net \
--to=linux@roeck-us.net \
--cc=duanqiangwen@net-swift.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox