Commit 12a0fd23 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

clk: Print an error when clk registration fails



We have a lot of driver code that prints an error message when
registering a clk fails. Do that in the core function instead to
consolidate code. This also helps drivers avoid the anti-pattern of
accessing the struct clk_hw::init pointer after registration.

Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20250226235408.1339266-1-sboyd@kernel.org
parent a1123951
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4397,6 +4397,13 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
fail_name:
	kref_put(&core->ref, __clk_release);
fail_out:
	if (dev) {
		dev_err_probe(dev, ret, "failed to register clk '%s' (%pS)\n",
			      init->name, hw);
	} else {
		pr_err("%pOF: error %pe: failed to register clk '%s' (%pS)\n",
		       np, ERR_PTR(ret), init->name, hw);
	}
	return ERR_PTR(ret);
}