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>
}
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);