msm_sdc_clk_init() reads the "max-frequency" DT property with
dev_read_u32(dev, "max-frequency", (uint *)(&clk_rate)), writing
only 4 bytes into clk_rate, an 8-byte ulong. The upper 4 bytes are
left uninitialized whenever the property is present. Read into a
u32 local instead, then assign it to clk_rate.

Signed-off-by: Aswin Murugan <[email protected]>
---
 drivers/mmc/msm_sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index 7bdb02142a2..e0753a1cd5d 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -70,8 +70,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
 
        var_info = (void *)dev_get_driver_data(dev);
 
-       if (dev_read_u32(dev, "max-frequency", (uint *)(&clk_rate)))
-               clk_rate = 201500000;
+       clk_rate = dev_read_u32_default(dev, "max-frequency", 201500000);
 
        ret = clk_get_bulk(dev, &prv->clks);
        if (ret) {
-- 
2.34.1

Reply via email to