[PATCH v4 07/17] lib/bootconfig: fix inconsistent if/else bracing in __xbc_add_key()

Josh Law posted 17 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH v4 07/17] lib/bootconfig: fix inconsistent if/else bracing in __xbc_add_key()
Posted by Josh Law 3 weeks, 2 days ago
When one branch of a conditional uses braces, both branches should
use them per coding-style section 3.1.  Add the missing braces to
the if/else blocks in __xbc_add_key().

Signed-off-by: Josh Law <objecting@objecting.org>
---
 lib/bootconfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 34bdc2d13881..58d6ae297280 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -657,9 +657,9 @@ static int __init __xbc_add_key(char *k)
 	if (unlikely(xbc_node_num == 0))
 		goto add_node;
 
-	if (!last_parent)	/* the first level */
+	if (!last_parent) {	/* the first level */
 		node = find_match_node(xbc_nodes, k);
-	else {
+	} else {
 		child = xbc_node_get_child(last_parent);
 		/* Since the value node is the first child, skip it. */
 		if (child && xbc_node_is_value(child))
@@ -667,9 +667,9 @@ static int __init __xbc_add_key(char *k)
 		node = find_match_node(child, k);
 	}
 
-	if (node)
+	if (node) {
 		last_parent = node;
-	else {
+	} else {
 add_node:
 		node = xbc_add_child(k, XBC_KEY);
 		if (!node)
-- 
2.34.1
Re: [PATCH v4 07/17] lib/bootconfig: fix inconsistent if/else bracing in __xbc_add_key()
Posted by Masami Hiramatsu (Google) 3 weeks, 1 day ago
On Sat, 14 Mar 2026 23:01:45 +0000
Josh Law <objecting@objecting.org> wrote:

> When one branch of a conditional uses braces, both branches should
> use them per coding-style section 3.1.  Add the missing braces to
> the if/else blocks in __xbc_add_key().

It is just a cosmetic cleanup.
Can you fold this with other typo fixes?

THank you,

> 
> Signed-off-by: Josh Law <objecting@objecting.org>
> ---
>  lib/bootconfig.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 34bdc2d13881..58d6ae297280 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -657,9 +657,9 @@ static int __init __xbc_add_key(char *k)
>  	if (unlikely(xbc_node_num == 0))
>  		goto add_node;
>  
> -	if (!last_parent)	/* the first level */
> +	if (!last_parent) {	/* the first level */
>  		node = find_match_node(xbc_nodes, k);
> -	else {
> +	} else {
>  		child = xbc_node_get_child(last_parent);
>  		/* Since the value node is the first child, skip it. */
>  		if (child && xbc_node_is_value(child))
> @@ -667,9 +667,9 @@ static int __init __xbc_add_key(char *k)
>  		node = find_match_node(child, k);
>  	}
>  
> -	if (node)
> +	if (node) {
>  		last_parent = node;
> -	else {
> +	} else {
>  add_node:
>  		node = xbc_add_child(k, XBC_KEY);
>  		if (!node)
> -- 
> 2.34.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>