diff options
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 1b356f1..3ab2583 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -68,7 +68,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, INIT_LIST_HEAD(&dev->sibling_node); INIT_LIST_HEAD(&dev->child_head); INIT_LIST_HEAD(&dev->uclass_node); -#ifdef CONFIG_DEVRES +#if CONFIG_IS_ENABLED(DEVRES) INIT_LIST_HEAD(&dev->devres_head); #endif dev_set_plat(dev, plat); @@ -1186,7 +1186,8 @@ int dev_enable_by_path(const char *path) static struct udevice_rt *dev_get_rt(const struct udevice *dev) { struct udevice *base = ll_entry_start(struct udevice, udevice); - int idx = dev - base; + uint each_size = dm_udevice_size(); + int idx = ((void *)dev - (void *)base) / each_size; struct udevice_rt *urt = gd_dm_udevice_rt() + idx; |