struct ast2500_clk_priv *priv = dev_get_priv(dev);
priv->scu = devfdt_get_addr_ptr(dev);
- if (IS_ERR(priv->scu))
- return PTR_ERR(priv->scu);
+ if (!priv->scu)
+ return -EINVAL;
return 0;
}
void *devfdt_get_addr_ptr(const struct udevice *dev)
{
- return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
+ fdt_addr_t addr = devfdt_get_addr_index(dev, 0);
+
+ return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
}
void *devfdt_remap_addr_index(const struct udevice *dev, int index)
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) {
}
priv->base_reg = devfdt_get_addr_ptr(dev);
- if (priv->base_reg == (void *)FDT_ADDR_T_NONE) {
+ if (!priv->base_reg) {
debug("%s: Failed to get base address\n", __func__);
return -EINVAL;
}
struct ast_timer_priv *priv = dev_get_priv(dev);
priv->regs = devfdt_get_addr_ptr(dev);
- if (IS_ERR(priv->regs))
- return PTR_ERR(priv->regs);
+ if (!priv->regs)
+ return -EINVAL;
priv->tmc = ast_get_timer_counter(priv->regs, AST_TICK_TIMER);
struct ast_wdt_priv *priv = dev_get_priv(dev);
priv->regs = devfdt_get_addr_ptr(dev);
- if (IS_ERR(priv->regs))
- return PTR_ERR(priv->regs);
+ if (!priv->regs)
+ return -EINVAL;
return 0;
}
static inline void *dev_read_addr_ptr(const struct udevice *dev)
{
- void *addr = devfdt_get_addr_ptr(dev);
-
- return ((fdt_addr_t)(uintptr_t)addr == FDT_ADDR_T_NONE) ? NULL : addr;
+ return devfdt_get_addr_ptr(dev);
}
static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev)