summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/ast_i2c.c
diff options
context:
space:
mode:
authorOvidiu Panait <ovidiu.panait@windriver.com>2020-08-03 22:17:35 +0300
committerSimon Glass <sjg@chromium.org>2020-08-22 07:59:14 -0600
commit3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c (patch)
tree4c61149fa9ef7f082f02ef176363e99cb2301ec5 /drivers/i2c/ast_i2c.c
parent02291d83fdaaf30e355eb7cef05581ec086962bd (diff)
downloadu-boot-3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c.tar.gz
u-boot-3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c.tar.xz
u-boot-3fe69d3764c3ca6f304c51faa6aae7a84f1fa56c.zip
dm: core: Fix devfdt_get_addr_ptr return value
According to the description of devfdt_get_addr_ptr, this function should return NULL on failure, but currently it returns (void *)FDT_ADDR_T_NONE. Fix this by making devfdt_get_addr_ptr return NULL on failure, as described in the function comments. Also, update the drivers currently checking (void *)FDT_ADDR_T_NONE to check for NULL. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/i2c/ast_i2c.c')
-rw-r--r--drivers/i2c/ast_i2c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c
index 214362d04b..253e653666 100644
--- a/drivers/i2c/ast_i2c.c
+++ b/drivers/i2c/ast_i2c.c
@@ -93,8 +93,8 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev)
int ret;
priv->regs = devfdt_get_addr_ptr(dev);
- if (IS_ERR(priv->regs))
- return PTR_ERR(priv->regs);
+ if (!priv->regs)
+ return -EINVAL;
ret = clk_get_by_index(dev, 0, &priv->clk);
if (ret < 0) {