Re: [PATCH] bootconfig: Fix missing return check of xbc_node_compose_key function

From
Masami Hiramatsu <mhiramat@kernel.org>
Date
2021-08-31 07:40:59
Reply to
Julio Faracco, 2021-08-31
On Tue, 31 Aug 2021 00:32:56 -0300
Julio Faracco [off-list ref] wrote:
The function `xbc_show_list should` handle the keys during the
composition. Even the errors returned by the compose function. Instead
of removing the `ret` variable, it should save the value and show the
exact error. This missing variable is causing a compilation issue also.
Oops, good catch! Hmm, I missed some intermediate patch for some commit.
Let me check.

Thanks,
quoted hunk ↗ jump to hunk
Signed-off-by: Julio Faracco <redacted>
---
 tools/bootconfig/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index f45fa992e01d..fd67496a947f 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -111,9 +111,11 @@ static void xbc_show_list(void)
 	char key[XBC_KEYLEN_MAX];
 	struct xbc_node *leaf;
 	const char *val;
+	int ret;
 
 	xbc_for_each_key_value(leaf, val) {
-		if (xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX) < 0) {
+		ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX);
+		if (ret < 0) {
 			fprintf(stderr, "Failed to compose key %d\n", ret);
 			break;
 		}
-- 
2.31.1

-- 
Masami Hiramatsu [off-list ref]
Thread (3 messages) 3 messages, 2 authors, last reply 2021-08-31
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help