From: Bin Meng Date: Fri, 4 Sep 2015 07:53:34 -0700 Subject: [U-Boot] [PATCH 4/5] dm: core: Remove the call to device_free() In-Reply-To: <1441378415-31243-1-git-send-email-bmeng.cn@gmail.com> References: <1441378415-31243-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1441378415-31243-4-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de When something goes wrong during device_probe(), we just need do device_remove() which calls device_free() internally. Signed-off-by: Bin Meng --- 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