dm: core: remove redundant if statement
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 15 Feb 2020 20:38:48 +0000 (21:38 +0100)
committerSimon Glass <sjg@chromium.org>
Thu, 16 Apr 2020 14:07:57 +0000 (08:07 -0600)
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>
drivers/core/device.c

index 89ea820d487e294cc39cdf84e2ba4d4ee8b35a33..534cfa7314d14914f52c8bb43cf8df63551af30b 100644 (file)
@@ -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)