mmc: hi6220_dw_mmc: Fix error detection for clk_get_rate

clk_get_rate() returns a ulong and that return value is assigned to a
member of a struct that is an unsigned int. So testing this value to <=
0 will only detect a return of 0. Also the code in the if block assumes
ret holds the return value when it does not. So update the test to one
that will work as intended and update the if block to actually refer to
the return value.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
This commit is contained in:
Andrew Goodbody
2025-10-21 17:08:25 +01:00
committed by Tom Rini
parent a58089ad2e
commit e24a7b3b17

View File

@@ -114,9 +114,9 @@ static int hi6220_dwmmc_probe(struct udevice *dev)
}
host->bus_hz = clk_get_rate(priv->clks[HI6220_DWMMC_CLK_CIU]);
if (host->bus_hz <= 0) {
dev_err(dev, "Failed to get ciu clock rate(ret = %d).\n", ret);
return log_msg_ret("clk", ret);
if (!host->bus_hz || IS_ERR_VALUE(host->bus_hz)) {
dev_err(dev, "Failed to get ciu clock rate(ret = %d).\n", host->bus_hz);
return log_msg_ret("clk", host->bus_hz);
}
}
dev_dbg(dev, "bus clock rate: %d.\n", host->bus_hz);