Skip to content

Commit

Permalink
clk: clk-rp1: Don't crash on duplicate clocks
Browse files Browse the repository at this point in the history
When using DTBs that don't match the kernel version, it's possible for
clock registration to fail. Handle that failure, in the hope that the
system can continue to boot, with a suitable error message.

Link: #6321

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell authored and popcornmix committed Nov 18, 2024
1 parent 7e84b80 commit e308bea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/clk/clk-rp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,11 @@ static int rp1_clk_probe(struct platform_device *pdev)
desc = &clk_desc_array[i];
if (desc->clk_register && desc->data) {
hws[i] = desc->clk_register(clockman, desc->data);
if (IS_ERR_OR_NULL(hws[i])) {
pr_err("Failed to register RP1 clock '%s' (%ld) - wrong dtbs?\n", *(char **)desc->data, PTR_ERR(hws[i]));
hws[i] = NULL;
continue;
}
if (!strcmp(clk_hw_get_name(hws[i]), "clk_i2s")) {
clk_i2s = hws[i];
clk_xosc = clk_hw_get_parent_by_index(clk_i2s, 0);
Expand Down

0 comments on commit e308bea

Please sign in to comment.