]> git.baikalelectronics.ru Git - uboot.git/commitdiff
clk: sifive: Fix -Wint-to-pointer-cast warning
authorBin Meng <bmeng.cn@gmail.com>
Sun, 12 Sep 2021 03:15:09 +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 pd->va is a pointer. In a 32-bit build, this causes the
following warning seen when building sifive-prci.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/clk/sifive/sifive-prci.c

index cd1acb944297455ea16ec190045d7edd1e4999a7..52ae268e0c8590fddf30cbb509603509d87ad851 100644 (file)
@@ -653,9 +653,9 @@ static int sifive_prci_probe(struct udevice *dev)
        struct prci_clk_desc *data =
                (struct prci_clk_desc *)dev_get_driver_data(dev);
 
-       pd->va = (void *)dev_read_addr(dev);
-       if (IS_ERR(pd->va))
-               return PTR_ERR(pd->va);
+       pd->va = dev_read_addr_ptr(dev);
+       if (!pd->va)
+               return -EINVAL;
 
        err = clk_get_by_index(dev, 0, &pd->parent_hfclk);
        if (err)