From: Vincent Mailhol <mailhol@kernel.org>
To: netdev@vger.kernel.org,
Stephen Hemminger <stephen@networkplumber.org>,
David Ahern <dsahern@gmail.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Oliver Hartkopp <socketcan@hartkopp.net>,
linux-kernel@vger.kernel.org, linux-can@vger.kernel.org,
Vincent Mailhol <mailhol@kernel.org>
Subject: [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage()
Date: Sun, 21 Sep 2025 16:32:32 +0900 [thread overview]
Message-ID: <20250921-iplink_can-checkpatch-fixes-v1-3-1ddab98560cd@kernel.org> (raw)
In-Reply-To: <20250921-iplink_can-checkpatch-fixes-v1-0-1ddab98560cd@kernel.org>
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
next prev parent reply other threads:[~2025-09-21 7:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Vincent Mailhol [this message]
2025-09-22 22:09 ` [PATCH iproute2-next 3/3] iplink_can: factorise the calls to usage() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250921-iplink_can-checkpatch-fixes-v1-3-1ddab98560cd@kernel.org \
--to=mailhol@kernel.org \
--cc=dsahern@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).