Paranoid programming [1] lies at the foundation of proper software
development, but the repetitive zeroint-out of output arguments in the
context of the same function rather clutters the code and inhibits
further refactoring/optimization than is doing any good.

In boot_get_fdt(), we already perform zero/NULL-initialization of
*of_flat_tree and *of_size at the beginning of the function, so doing
the same at function error-out is redundant/superfluous.

Moreover, keeping the code unchanged might encourage the developers to
update *of_flat_tree and *of_size during some interim computations,
which is against the current design of boot_get_fdt(). Currently,
writing useful data into these arguments happens just before
successfully returning from boot_get_fdt() and it should better stay so.

[1] https://blog.regehr.org/archives/1106

Signed-off-by: Eugeniu Rosca <ero...@de.adit-jv.com>
---
 common/image-fdt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 01186aeac7a4..1817ce6bce30 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -489,8 +489,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], 
uint8_t arch,
 no_fdt:
        ok_no_fdt = 1;
 error:
-       *of_flat_tree = NULL;
-       *of_size = 0;
        if (!select && ok_no_fdt) {
                debug("Continuing to boot without FDT\n");
                return 0;
-- 
2.21.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to