linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value"
       [not found]                               ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-02 19:42                                 ` SF Markus Elfring
  2014-11-03 10:35                                   ` Paul Bolle
  2014-11-03 18:40                                   ` [PATCH v2] " SF Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: SF Markus Elfring @ 2014-11-02 19:42 UTC (permalink / raw)
  To: Yann E. MORIN, linux-kbuild
  Cc: linux-kernel, kernel-janitors, trivial, Coccinelle

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(-)

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)
-- 
2.1.3



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

* Re: [PATCH 1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value"
  2014-11-02 19:42                                 ` [PATCH 1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value" SF Markus Elfring
@ 2014-11-03 10:35                                   ` Paul Bolle
  2014-11-03 18:40                                   ` [PATCH v2] " SF Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Bolle @ 2014-11-03 10:35 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Yann E. MORIN, linux-kbuild, linux-kernel, kernel-janitors,
	trivial, Coccinelle

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


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

* [PATCH v2] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value"
  2014-11-02 19:42                                 ` [PATCH 1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value" SF Markus Elfring
  2014-11-03 10:35                                   ` Paul Bolle
@ 2014-11-03 18:40                                   ` SF Markus Elfring
  2015-07-07 19:54                                     ` [PATCH v3] kconfig: Delete " SF Markus Elfring
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2014-11-03 18:40 UTC (permalink / raw)
  To: Yann E. MORIN, linux-kbuild
  Cc: linux-kernel, kernel-janitors, trivial, Coccinelle

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

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>
Acked-by: Paul Bolle <pebolle@tiscali.nl>
---
 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)
-- 
2.1.3



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

* [PATCH v3] kconfig: Delete unnecessary checks before the function call "sym_calc_value"
  2014-11-03 18:40                                   ` [PATCH v2] " SF Markus Elfring
@ 2015-07-07 19:54                                     ` SF Markus Elfring
  2015-08-19 14:46                                       ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2015-07-07 19:54 UTC (permalink / raw)
  To: Yann E. MORIN, linux-kbuild
  Cc: linux-kernel, kernel-janitors, Julia Lawall, Paul Bolle

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 Jul 2015 21:48:23 +0200

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 | 7 ++-----
 scripts/kconfig/symbol.c   | 3 +--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c814f57..0b7dc2f 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -268,8 +268,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;
 		}
 
@@ -404,9 +403,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 70c5ee1..50878dc 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -467,8 +467,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);
 }
 
 bool sym_tristate_within_range(struct symbol *sym, tristate val)
-- 
2.4.5


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

* Re: [PATCH v3] kconfig: Delete unnecessary checks before the function call "sym_calc_value"
  2015-07-07 19:54                                     ` [PATCH v3] kconfig: Delete " SF Markus Elfring
@ 2015-08-19 14:46                                       ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2015-08-19 14:46 UTC (permalink / raw)
  To: SF Markus Elfring, Yann E. MORIN, linux-kbuild
  Cc: linux-kernel, kernel-janitors, Julia Lawall, Paul Bolle

On 2015-07-07 21:54, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 7 Jul 2015 21:48:23 +0200
> 
> 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.

Applied to kbuild.git#kconfig.

Michal


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

end of thread, other threads:[~2015-08-19 14:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.sourceforge.net>
2014-11-02 19:42                                 ` [PATCH 1/1] kconfig: Deletion of unnecessary checks before the function call "sym_calc_value" SF Markus Elfring
2014-11-03 10:35                                   ` Paul Bolle
2014-11-03 18:40                                   ` [PATCH v2] " SF Markus Elfring
2015-07-07 19:54                                     ` [PATCH v3] kconfig: Delete " SF Markus Elfring
2015-08-19 14:46                                       ` Michal Marek

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).