[PATCH] clkdev: report over-sized strings when creating clkdev
Ron Economos
re at w6rz.net
Mon May 27 03:45:15 PDT 2024
On Fri, May 17, 2024 at 03:09:14PM -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 at net-swift.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
> > Reviewed-by: Stephen Boyd <sboyd at 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 ?
This issue causes a complete boot failure on real hardware (SiFive
Unmatched). The boot only gets as far as "Starting kernel ..." with no
other indication of what's going on.
Guenter's suggested patch solves the issue.
diff --git a/drivers/clk/sifive/sifive-prci.c
b/drivers/clk/sifive/sifive-prci.c
index 25b8e1a80ddc..20cc8f42d9eb 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -537,7 +537,7 @@ static int __prci_register_clocks(struct device
*dev, struct __prci_data *pd,
return r;
}
- r = clk_hw_register_clkdev(&pic->hw, pic->name,
dev_name(dev));
+ r = clk_hw_register_clkdev(&pic->hw, pic->name, "prci");
if (r) {
dev_warn(dev, "Failed to register clkdev for
%s: %d\n",
init.name, r);
More information about the linux-riscv
mailing list