All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: batman-adv: Remove useless braces
@ 2010-10-25 21:43 Sven Eckelmann
  2010-10-26  8:04 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Eckelmann @ 2010-10-25 21:43 UTC (permalink / raw)
  To: devel, linux-kernel; +Cc: sven.eckelmann, andy.shevchenko, gregkh

77099f0afe94928b5b0066a7efa5fa9f81696b54 added changes to vis.c which
trigger a checkpatch.pl warning about braces which are not necessary
anymore.

WARNING: braces {} are not necessary for any arm of this statement
+               if (entry->primary)
[...]
+               else {
[...]

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Marek Lindner <lindner_marek@yahoo.de>
Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 drivers/staging/batman-adv/vis.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c
index 3d2c1bc..4473cc8 100644
--- a/drivers/staging/batman-adv/vis.c
+++ b/drivers/staging/batman-adv/vis.c
@@ -135,9 +135,8 @@ static ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list)
 	hlist_for_each_entry(entry, pos, if_list, list) {
 		if (entry->primary)
 			len += sprintf(buff + len, "PRIMARY, ");
-		else {
+		else
 			len += sprintf(buff + len,  "SEC %pM, ", entry->addr);
-		}
 	}
 
 	return len;
-- 
1.7.2.3


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

* Re: [PATCH] Staging: batman-adv: Remove useless braces
  2010-10-25 21:43 [PATCH] Staging: batman-adv: Remove useless braces Sven Eckelmann
@ 2010-10-26  8:04 ` Andy Shevchenko
  2010-10-26  8:56   ` Sven Eckelmann
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2010-10-26  8:04 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: devel, linux-kernel, gregkh

It's odd.

I've checked it before submission:

andy@fs-test:~/prj/linux-2.6(mine)$ git show
77099f0afe94928b5b0066a7efa5fa9f81696b54 | scripts/checkpatch.pl -
total: 0 errors, 0 warnings, 177 lines checked

Your patch has no obvious style problems and is ready for submission.

On Tue, Oct 26, 2010 at 12:43 AM, Sven Eckelmann <sven.eckelmann@gmx.de> wrote:
> 77099f0afe94928b5b0066a7efa5fa9f81696b54 added changes to vis.c which
> trigger a checkpatch.pl warning about braces which are not necessary
> anymore.
>
> WARNING: braces {} are not necessary for any arm of this statement
> +               if (entry->primary)
> [...]
> +               else {
> [...]
>
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Marek Lindner <lindner_marek@yahoo.de>
> Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> Cc: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/staging/batman-adv/vis.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c
> index 3d2c1bc..4473cc8 100644
> --- a/drivers/staging/batman-adv/vis.c
> +++ b/drivers/staging/batman-adv/vis.c
> @@ -135,9 +135,8 @@ static ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list)
>        hlist_for_each_entry(entry, pos, if_list, list) {
>                if (entry->primary)
>                        len += sprintf(buff + len, "PRIMARY, ");
> -               else {
> +               else
>                        len += sprintf(buff + len,  "SEC %pM, ", entry->addr);
> -               }
>        }
>
>        return len;
> --
> 1.7.2.3
>
>



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] Staging: batman-adv: Remove useless braces
  2010-10-26  8:04 ` Andy Shevchenko
@ 2010-10-26  8:56   ` Sven Eckelmann
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2010-10-26  8:56 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: devel, linux-kernel, gregkh

[-- Attachment #1: Type: Text/Plain, Size: 1666 bytes --]

On Tuesday 26 October 2010 10:04:31 Andy Shevchenko wrote:
> It's odd.
> 
> I've checked it before submission:
> 
> andy@fs-test:~/prj/linux-2.6(mine)$ git show
> 77099f0afe94928b5b0066a7efa5fa9f81696b54 | scripts/checkpatch.pl -
> total: 0 errors, 0 warnings, 177 lines checked
> 
> Your patch has no obvious style problems and is ready for submission.

The problem seems to be that checkpatch doesn't check the generated file
(because it can't), but only the lines you changed. Those braces aren't on
lines you changed and thus they will not be checked.

But also checkpatch is sometimes a little bit "odd" when it comes to file type
detection (maybe more a user problem than a checkpatch problem)...

$ git show 77099f0afe94928b5b0066a7efa5fa9f81696b54:drivers/staging/batman-adv/vis.c| scripts/checkpatch.pl -f -
total: 0 errors, 0 warnings, 0 checks, 895 lines checked

Your patch has no obvious style problems and is ready for submission.
$ git show 77099f0afe94928b5b0066a7efa5fa9f81696b54:drivers/staging/batman-adv/vis.c > test.c
$ scripts/checkpatch.pl -f test.c                                                                                      
WARNING: braces {} are not necessary for any arm of this statement
#136: FILE: test.c:136:
+               if (entry->primary)
[...]
+               else {
[...]

total: 0 errors, 1 warnings, 895 lines checked

test.c has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.


When you call it test instead of test.c then it wouldn't find the problem
either.

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2010-10-26  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25 21:43 [PATCH] Staging: batman-adv: Remove useless braces Sven Eckelmann
2010-10-26  8:04 ` Andy Shevchenko
2010-10-26  8:56   ` Sven Eckelmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.