From patchwork Sat Feb 15 20:38:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 236396 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Sat, 15 Feb 2020 21:38:48 +0100 Subject: [PATCH 1/1] dm: core: remove redundant if statement Message-ID: <20200215203848.17823-1-xypron.glpk@gmx.de> 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 Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- drivers/core/device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.25.0 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)