Hi Marek,
On Wed, 8 Jul 2026 at 23:55, Marek Vasut [off-list ref] wrote:
On 7/8/26 12:15 PM, Geert Uytterhoeven wrote:
quoted
+static int register_fixed_clks(struct r8a78000_cpg_priv *priv)
+{
+ struct device *dev = priv->dev;
+ unsigned long rate;
+ struct clk_hw *hw;
+ const char *name;
+
+ for (unsigned int i = 0; i < ARRAY_SIZE(fixed_clk_rates); i++) {
+ rate = fixed_clk_rates[i];
+ name = devm_kasprintf(dev, GFP_KERNEL, "cpg-%lu", rate);
+ if (!name)
+ return -ENOMEM;
+
+ hw = clk_hw_register_fixed_rate(dev, name, NULL, 0, rate);
Would it be viable to use devm_clk_hw_register_fixed_rate() here ?
Yes, I think so; thanks!
quoted
+ if (IS_ERR(hw)) {
+ while (i-- > 0)
+ clk_hw_unregister_fixed_rate(priv->fixed_hws[i]);
+ return PTR_ERR(hw);
+ }
+
+ priv->fixed_hws[i] = hw;
+ }
+
+ return devm_add_action_or_reset(dev, unregister_fixed_clks, priv);
And then this, and unregister_fixed_clks() can go, and
r8a78000_cpg_priv.fixed_hws[] is no longer needed after probe.
quoted
+}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds