When something goes wrong during device_probe(), we just need do
device_remove() which calls device_free() internally.

Signed-off-by: Bin Meng <bmeng...@gmail.com>
---

 drivers/core/device.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index a6cd936..061a7ef 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -316,19 +316,14 @@ int device_probe_child(struct udevice *dev, void 
*parent_priv)
 
        ret = uclass_post_probe_device(dev);
        if (ret)
-               goto fail_uclass;
+               goto fail;
 
        return 0;
-fail_uclass:
+fail:
        if (device_remove(dev)) {
                dm_warn("%s: Device '%s' failed to remove on error path\n",
                        __func__, dev->name);
        }
-fail:
-       dev->flags &= ~DM_FLAG_ACTIVATED;
-
-       dev->seq = -1;
-       device_free(dev);
 
        return ret;
 }
-- 
1.8.2.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to