openwrt/target/linux/bcm27xx/patches-6.6/950-1286-clk-clk-rp1-Don-t-crash-on-duplicate-clocks.patch

31 lines
1.1 KiB
Diff
Raw Normal View History

From d290bef1f99e24cd590c64db149d007c6a631b65 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 16 Sep 2024 11:48:08 +0100
Subject: [PATCH 1286/1350] clk: clk-rp1: Don't crash on duplicate clocks
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: https://github.com/raspberrypi/linux/issues/6321
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/clk/clk-rp1.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/clk/clk-rp1.c
+++ b/drivers/clk/clk-rp1.c
@@ -2454,6 +2454,11 @@ static int rp1_clk_probe(struct platform
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);