diff options
author | Stephen Boyd <sboyd@kernel.org> | 2025-02-26 15:54:07 -0800 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2025-03-04 13:53:48 -0800 |
commit | 12a0fd23e87000e69b1777a9765c0c6e6eed0cd9 (patch) | |
tree | 8814b8b4e278f1bccd5672b434311058d4c0f946 | |
parent | a1123951b24759188010a6aa3d9d0be7b996bd39 (diff) |
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: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20250226235408.1339266-1-sboyd@kernel.org
-rw-r--r-- | drivers/clk/clk.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 00c1a89a852a..3938f2600209 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4397,6 +4397,13 @@ fail_ops: 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); } |