[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250921-iplink_can-checkpatch-fixes-v1-3-1ddab98560cd@kernel.org>
Date: Sun, 21 Sep 2025 16:32:32 +0900
From: Vincent Mailhol <mailhol@...nel.org>
To: netdev@...r.kernel.org, Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...il.com>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>,
Oliver Hartkopp <socketcan@...tkopp.net>, linux-kernel@...r.kernel.org,
linux-can@...r.kernel.org, Vincent Mailhol <mailhol@...nel.org>
Subject: [PATCH iproute2-next 3/3] iplink_can: factorise the calls to
usage()
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@...nel.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
Powered by blists - more mailing lists