diff mbox series

[4/8] spl: fit: Remove useless loop in spl_fit_get_image_name()

Message ID 20201216000944.2832585-5-mr.nuke.me@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series spl: fit: Play nicely with OP-TEE and Linux | expand

Commit Message

Alex G. Dec. 16, 2020, 12:09 a.m. UTC
When a desired configuration is not found, conf_node will have a
negative value. Thus the for loop will start at the root "/" node of
the image, print the "/description" property, and stop.

It appears the intent of the loop was to print the names of the
subnodes under "/configurations". We would need the offset to the
"/configurations" node, which is abstracted by fit_find_config_node().

This change agrees that abstracting the node offset is the correct
design, and we shouldn't be parsing the configurations manually. Thus
the loop in spl_fit_get_image_name() is useless. Remove it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
 common/spl/spl_fit.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Simon Glass Dec. 19, 2020, 2:29 a.m. UTC | #1
On Tue, 15 Dec 2020 at 17:10, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
>
> When a desired configuration is not found, conf_node will have a
> negative value. Thus the for loop will start at the root "/" node of
> the image, print the "/description" property, and stop.
>
> It appears the intent of the loop was to print the names of the
> subnodes under "/configurations". We would need the offset to the
> "/configurations" node, which is abstracted by fit_find_config_node().
>
> This change agrees that abstracting the node offset is the correct
> design, and we shouldn't be parsing the configurations manually. Thus
> the loop in spl_fit_get_image_name() is useless. Remove it.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
>  common/spl/spl_fit.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)

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

Patch

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index e6b27f61af..4e27eb0b3d 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -88,18 +88,8 @@  static int spl_fit_get_image_name(const struct spl_fit_info *ctx,
 	bool found = true;
 
 	conf_node = fit_find_config_node(ctx->fit);
-	if (conf_node < 0) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-		printf("No matching DT out of these options:\n");
-		for (node = fdt_first_subnode(ctx->fit, conf_node);
-		     node >= 0;
-		     node = fdt_next_subnode(ctx->fit, node)) {
-			name = fdt_getprop(ctx->fit, node, "description", &len);
-			printf("   %s\n", name);
-		}
-#endif
+	if (conf_node < 0)
 		return conf_node;
-	}
 
 	name = fdt_getprop(ctx->fit, conf_node, type, &len);
 	if (!name) {