]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gpio: sifive: Fix -Wint-to-pointer-cast warning
authorBin Meng <bmeng.cn@gmail.com>
Sun, 12 Sep 2021 03:15:10 +0000 (11:15 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Wed, 20 Oct 2021 02:59:09 +0000 (10:59 +0800)
dev_read_addr() returns a value of type fdt_addr_t which is a 64-bit
address and plat->base is a pointer. In a 32-bit build, this causes the
following warning seen when building sifive-gpio.c:

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

Change to use dev_read_addr_ptr().

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

index abd1f629b9b2ba85f98367f57e24e14fa6e612fd..151f484e8fd1c15cec00868daa26f183b4291d96 100644 (file)
@@ -157,13 +157,11 @@ static const struct dm_gpio_ops sifive_gpio_ops = {
 static int sifive_gpio_of_to_plat(struct udevice *dev)
 {
        struct sifive_gpio_plat *plat = dev_get_plat(dev);
-       fdt_addr_t addr;
 
-       addr = dev_read_addr(dev);
-       if (addr == FDT_ADDR_T_NONE)
+       plat->base = dev_read_addr_ptr(dev);
+       if (!plat->base)
                return -EINVAL;
 
-       plat->base = (void *)addr;
        return 0;
 }