diff mbox

[1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value"

Message ID 54568924.5010008@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring Nov. 2, 2014, 7:42 p.m. UTC
The sym_calc_value() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 scripts/kconfig/confdata.c | 6 ++----
 scripts/kconfig/symbol.c   | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

Comments

Paul Bolle Nov. 3, 2014, 10:35 a.m. UTC | #1
Since you use "SF Markus Elfring", this patch should start with:

From: Markus Elfring <elfring@users.sourceforge.net>

We don't care that you used a sourceforge.net address. Or has SF another
meaning? 

On Sun, 2014-11-02 at 20:42 +0100, SF Markus Elfring wrote:
> The sym_calc_value() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.

Side note: I guess the coccinelle script you use just skips cases like
    if (sym) {
        sym_calc_value(sym);
        do_foo_bar():
    }

Or did you filter those manually?

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  scripts/kconfig/confdata.c | 6 ++----
>  scripts/kconfig/symbol.c   | 3 +--
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index f88d90f..3073cb6 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -262,8 +262,7 @@ int conf_read_simple(const char *name, int def)
>  			goto load;
>  		sym_add_change_count(1);
>  		if (!sym_defconfig_list) {
> -			if (modules_sym)
> -				sym_calc_value(modules_sym);
> +			sym_calc_value(modules_sym);
>  			return 1;
>  		}
> 
> @@ -399,8 +398,7 @@ setsym:
>  	free(line);
>  	fclose(in);
> 
> -	if (modules_sym)
> -		sym_calc_value(modules_sym);
> +	sym_calc_value(modules_sym);
>  	return 0;
>  }
> 
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index 7caabdb..3f7797b 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -447,8 +447,7 @@ void sym_clear_all_valid(void)
>  	for_all_symbols(i, sym)
>  		sym->flags &= ~SYMBOL_VALID;
>  	sym_add_change_count(1);
> -	if (modules_sym)
> -		sym_calc_value(modules_sym);
> +	sym_calc_value(modules_sym);
>  }
> 
>  void sym_set_changed(struct symbol *sym)

Please resend with
    Acked-by: Paul Bolle <pebolle@tiscali.nl>

added.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..3073cb6 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -262,8 +262,7 @@  int conf_read_simple(const char *name, int def)
 			goto load;
 		sym_add_change_count(1);
 		if (!sym_defconfig_list) {
-			if (modules_sym)
-				sym_calc_value(modules_sym);
+			sym_calc_value(modules_sym);
 			return 1;
 		}

@@ -399,8 +398,7 @@  setsym:
 	free(line);
 	fclose(in);

-	if (modules_sym)
-		sym_calc_value(modules_sym);
+	sym_calc_value(modules_sym);
 	return 0;
 }

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 7caabdb..3f7797b 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -447,8 +447,7 @@  void sym_clear_all_valid(void)
 	for_all_symbols(i, sym)
 		sym->flags &= ~SYMBOL_VALID;
 	sym_add_change_count(1);
-	if (modules_sym)
-		sym_calc_value(modules_sym);
+	sym_calc_value(modules_sym);
 }

 void sym_set_changed(struct symbol *sym)