[PATCH 13/13] mmc: sdhci-brcmstb: Handle absent optional sdio_freq clock in probe

From: Lee Jones

Date: Mon Nov 23 2026 - 14:18:57 EST


Standard MMC Device Tree nodes may specify "clock-frequency" on SoCs
that do not provide the optional 72116B0 "sdio_freq" clock, in which
case devm_clk_get_optional() legitimately returns NULL. However,
sdhci_brcmstb_probe() only checks IS_ERR(base_clk): when base_clk is
NULL, clk_get_rate(base_clk) evaluates to 0 and overwrites
SDHCI_CLOCK_V3_BASE_MASK in host->caps with 0 MHz while leaving
priv->base_freq_hz non-zero for system resume.

Check IS_ERR_OR_NULL(base_clk) and clear priv->base_freq_hz on the
fallback path before jumping to add_host.

Fixes: 97904a59855c ("mmc: sdhci-brcmstb: Add ability to increase max clock rate for 72116b0")
Closes: https://sashiko.dev/#/bug/linux-88799a75-1ece-4f9d-bdab-eeb713627ab2
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/mmc/host/sdhci-brcmstb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index db857f2273e2..976cddb2ca9e 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -585,8 +585,10 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
goto add_host;

base_clk = devm_clk_get_optional(&pdev->dev, "sdio_freq");
- if (IS_ERR(base_clk)) {
- dev_warn(&pdev->dev, "Clock for \"sdio_freq\" not found\n");
+ if (IS_ERR_OR_NULL(base_clk)) {
+ if (IS_ERR(base_clk))
+ dev_warn(&pdev->dev, "Clock for \"sdio_freq\" not found\n");
+ priv->base_freq_hz = 0;
goto add_host;
}

--
2.56.1.750.gf70dc682cf-goog