linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/bootconfig: Simplify expression
@ 2021-04-14 13:46 zuoqilin1
  2021-04-16 16:09 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: zuoqilin1 @ 2021-04-14 13:46 UTC (permalink / raw)
  To: mhiramat; +Cc: linux-kernel, zuoqilin

From: zuoqilin <zuoqilin@yulong.com>

It is not necessary to define the variable ret to receive
the return value of the xbc_node_compose_key() method.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
---
 tools/bootconfig/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 7362bef..5fb309b 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -84,11 +84,9 @@ static void xbc_show_list(void)
 	char key[XBC_KEYLEN_MAX];
 	struct xbc_node *leaf;
 	const char *val;
-	int ret = 0;
 
 	xbc_for_each_key_value(leaf, val) {
-		ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX);
-		if (ret < 0)
+		if (xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX) < 0)
 			break;
 		printf("%s = ", key);
 		if (!val || val[0] == '\0') {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/bootconfig: Simplify expression
  2021-04-14 13:46 [PATCH] tools/bootconfig: Simplify expression zuoqilin1
@ 2021-04-16 16:09 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2021-04-16 16:09 UTC (permalink / raw)
  To: zuoqilin1, Steven Rostedt; +Cc: linux-kernel, zuoqilin

On Wed, 14 Apr 2021 21:46:47 +0800
zuoqilin1@163.com wrote:

> From: zuoqilin <zuoqilin@yulong.com>
> 
> It is not necessary to define the variable ret to receive
> the return value of the xbc_node_compose_key() method.
> 
> Signed-off-by: zuoqilin <zuoqilin@yulong.com>

Indeed.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> ---
>  tools/bootconfig/main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
> index 7362bef..5fb309b 100644
> --- a/tools/bootconfig/main.c
> +++ b/tools/bootconfig/main.c
> @@ -84,11 +84,9 @@ static void xbc_show_list(void)
>  	char key[XBC_KEYLEN_MAX];
>  	struct xbc_node *leaf;
>  	const char *val;
> -	int ret = 0;
>  
>  	xbc_for_each_key_value(leaf, val) {
> -		ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX);
> -		if (ret < 0)
> +		if (xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX) < 0)
>  			break;
>  		printf("%s = ", key);
>  		if (!val || val[0] == '\0') {
> -- 
> 1.9.1
> 
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-16 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 13:46 [PATCH] tools/bootconfig: Simplify expression zuoqilin1
2021-04-16 16:09 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).