msm8916-openwrt/target/linux/bcm27xx/patches-6.6/950-0789-bcm2835-sdhost-Fail-gracefully-with-bad-dtb.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

52 lines
1.7 KiB
Diff

From 4a8f7f7661252072494ac16d3edc035193c6ea04 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 11 Dec 2023 11:20:28 +0000
Subject: [PATCH 0789/1085] bcm2835-sdhost: Fail gracefully with bad dtb
The logging timestamps depend on the existence of a bcm2835-system-timer
node. If this node doesn't exist, leave the logging disabled rather than
crashing.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/mmc/host/bcm2835-sdhost.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
--- a/drivers/mmc/host/bcm2835-sdhost.c
+++ b/drivers/mmc/host/bcm2835-sdhost.c
@@ -247,19 +247,22 @@ static void log_init(struct device *dev)
struct device_node *np;
spin_lock_init(&log_lock);
- sdhost_log_buf = dma_alloc_coherent(dev, LOG_SIZE, &sdhost_log_addr,
- GFP_KERNEL);
- if (sdhost_log_buf) {
- np = of_find_compatible_node(NULL, NULL,
- "brcm,bcm2835-system-timer");
- pr_info("sdhost: log_buf @ %p (%llx)\n",
- sdhost_log_buf, (u64)sdhost_log_addr);
- timer_base = of_iomap(np, 0);
- if (!timer_base)
- pr_err("sdhost: failed to remap timer\n");
+
+ np = of_find_compatible_node(NULL, NULL,
+ "brcm,bcm2835-system-timer");
+ timer_base = of_iomap(np, 0);
+
+ if (timer_base) {
+ sdhost_log_buf = dma_alloc_coherent(dev, LOG_SIZE, &sdhost_log_addr,
+ GFP_KERNEL);
+ if (sdhost_log_buf)
+ pr_info("sdhost: log_buf @ %p (%llx)\n",
+ sdhost_log_buf, (u64)sdhost_log_addr);
+ else
+ pr_err("sdhost: failed to allocate log buf\n");
+ } else {
+ pr_err("sdhost: failed to remap timer - wrong dtb?\n");
}
- else
- pr_err("sdhost: failed to allocate log buf\n");
}
static void log_event_impl(const char *event, u32 param1, u32 param2)