diff --git a/drivers/core/device.c b/drivers/core/device.c index 818d03fac1..1e5584a7ce 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -135,6 +135,11 @@ int device_bind(struct udevice *parent, const struct driver *drv, if (ret) goto fail_child_post_bind; } + if (uc->uc_drv->post_bind) { + ret = uc->uc_drv->post_bind(dev); + if (ret) + goto fail_uclass_post_bind; + } if (parent) dm_dbg("Bound device %s to %s\n", dev->name, parent->name); @@ -145,6 +150,8 @@ int device_bind(struct udevice *parent, const struct driver *drv, return 0; +fail_uclass_post_bind: + /* There is no child unbind() method, so no clean-up required */ fail_child_post_bind: if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) { if (drv->unbind && drv->unbind(dev)) { diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 36bcf197aa..e1acefe727 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -430,11 +430,6 @@ int uclass_bind_device(struct udevice *dev) goto err; } } - if (uc->uc_drv->post_bind) { - ret = uc->uc_drv->post_bind(dev); - if (ret) - goto err; - } return 0; err: