From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Sat, 15 Feb 2020 20:38:48 +0000 (+0100)
Subject: dm: core: remove redundant if statement
X-Git-Tag: v2025.01-rc5-pxa1908~2478^2~23
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/gitweb.css?a=commitdiff_plain;h=f93a07dd4f2e9096208a3230b0eca669d9760397;p=u-boot.git

dm: core: remove redundant if statement

The value of parent is not changed in the first if statement. So we can
merge the two if statements depending on parent.

Indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 89ea820d48..534cfa7314 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -143,11 +143,9 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 				goto fail_alloc3;
 			}
 		}
-	}
-
-	/* put dev into parent's successor list */
-	if (parent)
+		/* put dev into parent's successor list */
 		list_add_tail(&dev->sibling_node, &parent->child_head);
+	}
 
 	ret = uclass_bind_device(dev);
 	if (ret)