aboutsummaryrefslogtreecommitdiff
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorJohan Jonker <jbx6244@gmail.com>2023-03-13 01:31:49 +0100
committerKever Yang <kever.yang@rock-chips.com>2023-05-06 17:28:18 +0800
commite5822ecba2d73e64ca55c26fc4762d9e80b1f1b5 (patch)
treeed5afa03d8d1d2f8b27ee44a8d19c215f7017378 /drivers/watchdog
parent8fa64bd1715d38f079e1369d282ac06c879be083 (diff)
downloadu-boot-e5822ecba2d73e64ca55c26fc4762d9e80b1f1b5.zip
u-boot-e5822ecba2d73e64ca55c26fc4762d9e80b1f1b5.tar.gz
u-boot-e5822ecba2d73e64ca55c26fc4762d9e80b1f1b5.tar.bz2
drivers: use dev_read_addr_index_ptr when cast to pointer
The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use dev_read_addr_index_ptr instead of the dev_read_addr_index function in the various files in the drivers directory that cast to a pointer. As we are there also streamline the error response to -EINVAL on return. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/sbsa_gwdt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index f43cd3f..96d0466 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -98,13 +98,13 @@ static int sbsa_gwdt_of_to_plat(struct udevice *dev)
{
struct sbsa_gwdt_priv *priv = dev_get_priv(dev);
- priv->reg_control = (void __iomem *)dev_read_addr_index(dev, 0);
- if (IS_ERR(priv->reg_control))
- return PTR_ERR(priv->reg_control);
+ priv->reg_control = dev_read_addr_index_ptr(dev, 0);
+ if (!priv->reg_control)
+ return -EINVAL;
- priv->reg_refresh = (void __iomem *)dev_read_addr_index(dev, 1);
- if (IS_ERR(priv->reg_refresh))
- return PTR_ERR(priv->reg_refresh);
+ priv->reg_refresh = dev_read_addr_index_ptr(dev, 1);
+ if (!priv->reg_refresh)
+ return -EINVAL;
return 0;
}