All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2] fix set-not-used warnings
Date: Sun, 17 Sep 2023 10:08:25 -0700	[thread overview]
Message-ID: <20230917170825.26165-1-stephen@networkplumber.org> (raw)

Building with clang and warnings enabled finds several
places where variable was set but not used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 bridge/vni.c  | 3 +--
 ip/iptuntap.c | 3 ---
 tc/m_pedit.c  | 3 +--
 tc/q_tbf.c    | 8 --------
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/bridge/vni.c b/bridge/vni.c
index 5978e55c79fd..e804cb3f40c3 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -49,13 +49,12 @@ static int parse_vni_filter(const char *argv, struct nlmsghdr *n, int reqsize,
 	int group_type = AF_UNSPEC;
 	struct rtattr *nlvlist_e;
 	char *v;
-	int i;
 
 	if (group && is_addrtype_inet(group))
 		group_type = (group->family == AF_INET) ?  VXLAN_VNIFILTER_ENTRY_GROUP :
 						     VXLAN_VNIFILTER_ENTRY_GROUP6;
 
-	for (i = 0; vni; i++) {
+	while (vni != NULL) {
 		__u32 vni_start = 0, vni_end = 0;
 
 		v = strchr(vni, '-');
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 552599e9fa5c..dbb07580f68e 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -107,8 +107,6 @@ static int tap_del_ioctl(struct ifreq *ifr)
 static int parse_args(int argc, char **argv,
 		      struct ifreq *ifr, uid_t *uid, gid_t *gid)
 {
-	int count = 0;
-
 	memset(ifr, 0, sizeof(*ifr));
 
 	ifr->ifr_flags |= IFF_NO_PI;
@@ -187,7 +185,6 @@ static int parse_args(int argc, char **argv,
 			if (get_ifname(ifr->ifr_name, *argv))
 				invarg("\"name\" not a valid ifname", *argv);
 		}
-		count++;
 		argc--; argv++;
 	}
 
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index afdd020b92bc..32f03415d61c 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -627,7 +627,7 @@ static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p,
 
 	int argc = *argc_p;
 	char **argv = *argv_p;
-	int ok = 0, iok = 0;
+	int ok = 0;
 	struct rtattr *tail;
 
 	while (argc > 0) {
@@ -689,7 +689,6 @@ static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p,
 			}
 			argc--;
 			argv++;
-			iok++;
 		}
 	}
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index caea6bebd871..f621756d96e6 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -34,7 +34,6 @@ static void explain1(const char *arg, const char *val)
 static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 			 struct nlmsghdr *n, const char *dev)
 {
-	int ok = 0;
 	struct tc_tbf_qopt opt = {};
 	__u32 rtab[256];
 	__u32 ptab[256];
@@ -60,7 +59,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("limit", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "latency") == 0) {
 			NEXT_ARG();
 			if (latency) {
@@ -75,7 +73,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("latency", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "burst") == 0 ||
 			strcmp(*argv, "buffer") == 0 ||
 			strcmp(*argv, "maxburst") == 0) {
@@ -90,7 +87,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1(parm_name, *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "mtu") == 0 ||
 			   strcmp(*argv, "minburst") == 0) {
 			const char *parm_name = *argv;
@@ -104,7 +100,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1(parm_name, *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "mpu") == 0) {
 			NEXT_ARG();
 			if (mpu) {
@@ -115,7 +110,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("mpu", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "rate") == 0) {
 			NEXT_ARG();
 			if (rate64) {
@@ -131,7 +125,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("rate", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "peakrate") == 0) {
 			NEXT_ARG();
 			if (prate64) {
@@ -147,7 +140,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("peakrate", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "overhead") == 0) {
 			NEXT_ARG();
 			if (overhead) {
-- 
2.39.2


             reply	other threads:[~2023-09-17 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17 17:08 Stephen Hemminger [this message]
2023-09-18  9:29 ` [PATCH iproute2] fix set-not-used warnings Andrea Claudi

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=20230917170825.26165-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.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 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.