linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings
@ 2025-09-21  7:32 Vincent Mailhol
  2025-09-21  7:32 ` [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format Vincent Mailhol
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Vincent Mailhol @ 2025-09-21  7:32 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern
  Cc: Marc Kleine-Budde, Oliver Hartkopp, linux-kernel, linux-can,
	Vincent Mailhol

This is a clean up series which goes through all the checkpatch
warnings on ip/iplink_can.c and fixes them one by one. By the end on
this series, there is only one warning left:

  WARNING: Prefer __printf(2, 0) over __attribute__((format(printf, 2, 0)))
  #320: FILE: ip/iplink_can.c:320:
  +static void __attribute__((format(printf, 2, 0)))

Because iproute2 does not declare the __printf() macro, that last one
can not be fixed.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>

---
Vincent Mailhol (3):
      iplink_can: fix coding style for pointer format
      iplink_can: fix SPDX-License-Identifier tag format
      iplink_can: factorise the calls to usage()

 ip/iplink_can.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
base-commit: afceddf61037440628a5612f15a6eaefd28d9fd3
change-id: 20250921-iplink_can-checkpatch-fixes-1ca804bd4fa4

Best regards,
-- 
Vincent Mailhol <mailhol@kernel.org>


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

* [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format
  2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
@ 2025-09-21  7:32 ` Vincent Mailhol
  2025-09-22 22:10   ` Stephen Hemminger
  2025-09-21  7:32 ` [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format Vincent Mailhol
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Vincent Mailhol @ 2025-09-21  7:32 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern
  Cc: Marc Kleine-Budde, Oliver Hartkopp, linux-kernel, linux-can,
	Vincent Mailhol

checkpatch.pl complains about the pointer symbol * being attached to the
type instead of being attached to the variable:

  ERROR: "foo* bar" should be "foo *bar"
  #85: FILE: ip/iplink_can.c:85:
  +		       const char* name)

  ERROR: "foo* bar" should be "foo *bar"
  #93: FILE: ip/iplink_can.c:93:
  +static void print_ctrlmode(enum output_type t, __u32 flags, const char* key)

Fix those two warnings.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 ip/iplink_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 9f6084e63986bd05d25a050176f4640c30596b85..1afdf08825f3d9cbbb0454592d2ed7dc1388a6de 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -82,7 +82,7 @@ static void set_ctrlmode(char *name, char *arg,
 }
 
 static void print_flag(enum output_type t, __u32 *flags, __u32 flag,
-		       const char* name)
+		       const char *name)
 {
 	if (*flags & flag) {
 		*flags &= ~flag;
@@ -90,7 +90,7 @@ static void print_flag(enum output_type t, __u32 *flags, __u32 flag,
 	}
 }
 
-static void print_ctrlmode(enum output_type t, __u32 flags, const char* key)
+static void print_ctrlmode(enum output_type t, __u32 flags, const char *key)
 {
 	if (!flags)
 		return;

-- 
2.49.1


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

* [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format
  2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
  2025-09-21  7:32 ` [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format Vincent Mailhol
@ 2025-09-21  7:32 ` Vincent Mailhol
  2025-09-22 22:08   ` Stephen Hemminger
  2025-09-21  7:32 ` [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage() Vincent Mailhol
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Vincent Mailhol @ 2025-09-21  7:32 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern
  Cc: Marc Kleine-Budde, Oliver Hartkopp, linux-kernel, linux-can,
	Vincent Mailhol

In .c files, the SPDX tag uses the C++ comment style.

Fix below checkpatch.pl warning:

  WARNING: Improper SPDX comment style for 'ip/iplink_can.c', please use '//' instead
  #1: FILE: ip/iplink_can.c:1:
  +/* SPDX-License-Identifier: GPL-2.0-or-later */

  WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
  #1: FILE: ip/iplink_can.c:1:
  +/* SPDX-License-Identifier: GPL-2.0-or-later */

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 ip/iplink_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 1afdf08825f3d9cbbb0454592d2ed7dc1388a6de..56c258b023ef57e37574f44981b76086a0a140db 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * iplink_can.c	CAN device support
  *

-- 
2.49.1


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

* [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage()
  2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
  2025-09-21  7:32 ` [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format Vincent Mailhol
  2025-09-21  7:32 ` [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format Vincent Mailhol
@ 2025-09-21  7:32 ` Vincent Mailhol
  2025-09-22 22:09   ` Stephen Hemminger
  2025-09-22  8:42 ` [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Marc Kleine-Budde
  2025-09-25 16:40 ` patchwork-bot+netdevbpf
  4 siblings, 1 reply; 10+ messages in thread
From: Vincent Mailhol @ 2025-09-21  7:32 UTC (permalink / raw)
  To: netdev, Stephen Hemminger, David Ahern
  Cc: Marc Kleine-Budde, Oliver Hartkopp, linux-kernel, linux-can,
	Vincent Mailhol

usage() is called either if the user passes the "help" argument or passes
an invalid argument.

Factorise those two cases together.

This silences below checkpatch.pl warning:

  WARNING: else is not generally useful after a break or return
  #274: FILE: ip/iplink_can.c:274:
  +			return -1;
  +		} else {

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
 ip/iplink_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 56c258b023ef57e37574f44981b76086a0a140db..2a13df7bcf6d404e17cf747f29c682fa80e4f6fc 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -268,11 +268,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid \"termination\" value",
 				       *argv);
 			addattr16(n, 1024, IFLA_CAN_TERMINATION, val);
-		} else if (matches(*argv, "help") == 0) {
-			usage();
-			return -1;
 		} else {
-			fprintf(stderr, "can: unknown option \"%s\"\n", *argv);
+			if (matches(*argv, "help") != 0)
+				fprintf(stderr, "can: unknown option \"%s\"\n", *argv);
 			usage();
 			return -1;
 		}

-- 
2.49.1


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

* Re: [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings
  2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
                   ` (2 preceding siblings ...)
  2025-09-21  7:32 ` [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage() Vincent Mailhol
@ 2025-09-22  8:42 ` Marc Kleine-Budde
  2025-09-25 16:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2025-09-22  8:42 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, Stephen Hemminger, David Ahern, Oliver Hartkopp,
	linux-kernel, linux-can

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

On 21.09.2025 16:32:29, Vincent Mailhol wrote:
> This is a clean up series which goes through all the checkpatch
> warnings on ip/iplink_can.c and fixes them one by one. By the end on
> this series, there is only one warning left:
> 
>   WARNING: Prefer __printf(2, 0) over __attribute__((format(printf, 2, 0)))
>   #320: FILE: ip/iplink_can.c:320:
>   +static void __attribute__((format(printf, 2, 0)))
> 
> Because iproute2 does not declare the __printf() macro, that last one
> can not be fixed.
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>

For the whole series:

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format
  2025-09-21  7:32 ` [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format Vincent Mailhol
@ 2025-09-22 22:08   ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2025-09-22 22:08 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, David Ahern, Marc Kleine-Budde, Oliver Hartkopp,
	linux-kernel, linux-can

On Sun, 21 Sep 2025 16:32:31 +0900
Vincent Mailhol <mailhol@kernel.org> wrote:

> In .c files, the SPDX tag uses the C++ comment style.
> 
> Fix below checkpatch.pl warning:
> 
>   WARNING: Improper SPDX comment style for 'ip/iplink_can.c', please use '//' instead
>   #1: FILE: ip/iplink_can.c:1:
>   +/* SPDX-License-Identifier: GPL-2.0-or-later */
> 
>   WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
>   #1: FILE: ip/iplink_can.c:1:
>   +/* SPDX-License-Identifier: GPL-2.0-or-later */
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>

NAK
Iproute2 excepts both formats and both are used in several
places.

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

* Re: [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage()
  2025-09-21  7:32 ` [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage() Vincent Mailhol
@ 2025-09-22 22:09   ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2025-09-22 22:09 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, David Ahern, Marc Kleine-Budde, Oliver Hartkopp,
	linux-kernel, linux-can

On Sun, 21 Sep 2025 16:32:32 +0900
Vincent Mailhol <mailhol@kernel.org> wrote:

> usage() is called either if the user passes the "help" argument or passes
> an invalid argument.
> 
> Factorise those two cases together.
> 
> This silences below checkpatch.pl warning:
> 
>   WARNING: else is not generally useful after a break or return
>   #274: FILE: ip/iplink_can.c:274:
>   +			return -1;
>   +		} else {
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---

Not accepting most checkpatch stuff in iproute2.
Better to not have code churn

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

* Re: [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format
  2025-09-21  7:32 ` [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format Vincent Mailhol
@ 2025-09-22 22:10   ` Stephen Hemminger
  2025-09-23  2:07     ` Vincent Mailhol
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2025-09-22 22:10 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, David Ahern, Marc Kleine-Budde, Oliver Hartkopp,
	linux-kernel, linux-can

On Sun, 21 Sep 2025 16:32:30 +0900
Vincent Mailhol <mailhol@kernel.org> wrote:

> checkpatch.pl complains about the pointer symbol * being attached to the
> type instead of being attached to the variable:
> 
>   ERROR: "foo* bar" should be "foo *bar"
>   #85: FILE: ip/iplink_can.c:85:
>   +		       const char* name)
> 
>   ERROR: "foo* bar" should be "foo *bar"
>   #93: FILE: ip/iplink_can.c:93:
>   +static void print_ctrlmode(enum output_type t, __u32 flags, const char* key)
> 
> Fix those two warnings.
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
> ---

This is ok, to fix. 

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

* Re: [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format
  2025-09-22 22:10   ` Stephen Hemminger
@ 2025-09-23  2:07     ` Vincent Mailhol
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Mailhol @ 2025-09-23  2:07 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev, David Ahern, Marc Kleine-Budde, Oliver Hartkopp,
	linux-kernel, linux-can

On 23/09/2025 at 07:10, Stephen Hemminger wrote:
> On Sun, 21 Sep 2025 16:32:30 +0900
> Vincent Mailhol <mailhol@kernel.org> wrote:
> 
>> checkpatch.pl complains about the pointer symbol * being attached to the
>> type instead of being attached to the variable:
>>
>>   ERROR: "foo* bar" should be "foo *bar"
>>   #85: FILE: ip/iplink_can.c:85:
>>   +		       const char* name)
>>
>>   ERROR: "foo* bar" should be "foo *bar"
>>   #93: FILE: ip/iplink_can.c:93:
>>   +static void print_ctrlmode(enum output_type t, __u32 flags, const char* key)
>>
>> Fix those two warnings.
>>
>> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
>> ---
> 
> This is ok, to fix. 

With the other two patches being Nack-ed, we are only left with this one in the
series.

Do you want me to resend or do you prefer to directly cherry pick this one?


Yours sincerely,
Vincent Mailhol


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

* Re: [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings
  2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
                   ` (3 preceding siblings ...)
  2025-09-22  8:42 ` [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Marc Kleine-Budde
@ 2025-09-25 16:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-25 16:40 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: netdev, stephen, dsahern, mkl, socketcan, linux-kernel, linux-can

Hello:

This series was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Sun, 21 Sep 2025 16:32:29 +0900 you wrote:
> This is a clean up series which goes through all the checkpatch
> warnings on ip/iplink_can.c and fixes them one by one. By the end on
> this series, there is only one warning left:
> 
>   WARNING: Prefer __printf(2, 0) over __attribute__((format(printf, 2, 0)))
>   #320: FILE: ip/iplink_can.c:320:
>   +static void __attribute__((format(printf, 2, 0)))
> 
> [...]

Here is the summary with links:
  - [iproute2-next,1/3] iplink_can: fix coding style for pointer format
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=bcddc725eef5
  - [iproute2-next,2/3] iplink_can: fix SPDX-License-Identifier tag format
    (no matching commit)
  - [iproute2-next,3/3] iplink_can: factorise the calls to usage()
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-09-25 16:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-21  7:32 [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Vincent Mailhol
2025-09-21  7:32 ` [PATCH iproute2-next 1/3] iplink_can: fix coding style for pointer format Vincent Mailhol
2025-09-22 22:10   ` Stephen Hemminger
2025-09-23  2:07     ` Vincent Mailhol
2025-09-21  7:32 ` [PATCH iproute2-next 2/3] iplink_can: fix SPDX-License-Identifier tag format Vincent Mailhol
2025-09-22 22:08   ` Stephen Hemminger
2025-09-21  7:32 ` [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage() Vincent Mailhol
2025-09-22 22:09   ` Stephen Hemminger
2025-09-22  8:42 ` [PATCH iproute2-next 0/3] iplink_can: fix checkpatch.pl warnings Marc Kleine-Budde
2025-09-25 16:40 ` patchwork-bot+netdevbpf

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