diff mbox series

dm: core: Fix uninitialized return value from dm_scan_fdt_node

Message ID 20210408211500.2843290-1-sean.anderson@seco.com
State Accepted
Commit 6784cb35f52b1f742a4b56cc6b5697b6ca784598
Delegated to: Simon Glass
Headers show
Series dm: core: Fix uninitialized return value from dm_scan_fdt_node | expand

Commit Message

Sean Anderson April 8, 2021, 9:15 p.m. UTC
If there are no nodes or if all nodes are disabled, this function would
return err without setting it first. Fix this by initializing err to
zero.

Fixes: 94f7afdf7e ("dm: core: Ignore disabled devices when binding")

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 drivers/core/root.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass April 14, 2021, 7:38 p.m. UTC | #1
On Thu, 8 Apr 2021 at 22:15, Sean Anderson <sean.anderson@seco.com> wrote:
>
> If there are no nodes or if all nodes are disabled, this function would
> return err without setting it first. Fix this by initializing err to
> zero.
>
> Fixes: 94f7afdf7e ("dm: core: Ignore disabled devices when binding")
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  drivers/core/root.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass April 29, 2021, 4:03 p.m. UTC | #2
On Thu, 8 Apr 2021 at 22:15, Sean Anderson <sean.anderson@seco.com> wrote:
>
> If there are no nodes or if all nodes are disabled, this function would
> return err without setting it first. Fix this by initializing err to
> zero.
>
> Fixes: 94f7afdf7e ("dm: core: Ignore disabled devices when binding")
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
>  drivers/core/root.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index d9a19c5e6b..f852d867db 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -265,7 +265,7 @@  int dm_scan_plat(bool pre_reloc_only)
 static int dm_scan_fdt_node(struct udevice *parent, ofnode parent_node,
 			    bool pre_reloc_only)
 {
-	int ret = 0, err;
+	int ret = 0, err = 0;
 	ofnode node;
 
 	if (!ofnode_valid(parent_node))