serial: sifive: Cast dev_read_addr() with uintptr_t
authorBin Meng <bin.meng@windriver.com>
Sun, 31 Jan 2021 12:36:00 +0000 (20:36 +0800)
committerSimon Glass <sjg@chromium.org>
Wed, 3 Feb 2021 10:38:41 +0000 (03:38 -0700)
dev_read_addr() returns fdt_addr_t which is now a 64-bit address.
In a 32-bit build, this causes the following warning seen when
building serial_sifive.c:

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

Cast the return value with uintptr_t.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
drivers/serial/serial_sifive.c

index d26fe7e770430c6d9af2bd5e199a5a78c43d436b..97bf20c967ad87ce5bbd100652a9503f74e15155 100644 (file)
@@ -178,7 +178,7 @@ static int sifive_serial_of_to_plat(struct udevice *dev)
 {
        struct sifive_uart_plat *plat = dev_get_plat(dev);
 
-       plat->regs = (struct uart_sifive *)dev_read_addr(dev);
+       plat->regs = (struct uart_sifive *)(uintptr_t)dev_read_addr(dev);
        if (IS_ERR(plat->regs))
                return PTR_ERR(plat->regs);