diff mbox series

[2/9] clk: sifive: Fix -Wint-to-pointer-cast warning

Message ID 20210912031516.24885-2-bmeng.cn@gmail.com
State Accepted
Commit 2edb02ead760630a6495d4e583e2364d10cb850a
Delegated to: Andes
Headers show
Series [1/9] cache: sifive: Fix -Wint-to-pointer-cast warning | expand

Commit Message

Bin Meng Sept. 12, 2021, 3:15 a.m. UTC
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>
---

 drivers/clk/sifive/sifive-prci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Leo Liang Sept. 15, 2021, 3:46 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:09AM +0800, Bin Meng wrote:
> 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>
> ---
> 
>  drivers/clk/sifive/sifive-prci.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
diff mbox series

Patch

diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
index cd1acb9442..52ae268e0c 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -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)