]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ram: sifive: Fix -Wint-to-pointer-cast warnings
authorBin Meng <bmeng.cn@gmail.com>
Sun, 12 Sep 2021 03:15:15 +0000 (11:15 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Wed, 20 Oct 2021 02:59:09 +0000 (10:59 +0800)
The following warning is seen in sifive_ddr.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_index_ptr().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
drivers/ram/sifive/sifive_ddr.c

index ba1846603313db0a6c3f71b57ef98b9ecd272835..4bd69a62be2b690c0e0db3f9f2b203ca76416e5a 100644 (file)
@@ -313,7 +313,7 @@ static int sifive_ddr_setup(struct udevice *dev)
        sifive_ddr_phy_fixup(denali_phy);
 
        /* check size */
-       priv->info.size = get_ram_size((long *)priv->info.base,
+       priv->info.size = get_ram_size((long *)(uintptr_t)priv->info.base,
                                       ddr_size);
 
        debug("%s : %lx\n", __func__, (uintptr_t)priv->info.size);
@@ -369,9 +369,9 @@ static int sifive_ddr_probe(struct udevice *dev)
                return ret;
        }
 
-       priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index(dev, 0);
-       priv->phy = (struct sifive_ddrphy *)dev_read_addr_index(dev, 1);
-       priv->physical_filter_ctrl = (u32 *)dev_read_addr_index(dev, 2);
+       priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index_ptr(dev, 0);
+       priv->phy = (struct sifive_ddrphy *)dev_read_addr_index_ptr(dev, 1);
+       priv->physical_filter_ctrl = (u32 *)dev_read_addr_index_ptr(dev, 2);
 
        return sifive_ddr_setup(dev);
 #endif