* [PATCH iproute2] fix set-not-used warnings
@ 2023-09-17 17:08 Stephen Hemminger
2023-09-18 9:29 ` Andrea Claudi
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2023-09-17 17:08 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] fix set-not-used warnings
2023-09-17 17:08 [PATCH iproute2] fix set-not-used warnings Stephen Hemminger
@ 2023-09-18 9:29 ` Andrea Claudi
0 siblings, 0 replies; 2+ messages in thread
From: Andrea Claudi @ 2023-09-18 9:29 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Sun, Sep 17, 2023 at 10:08:25AM -0700, Stephen Hemminger wrote:
> Building with clang and warnings enabled finds several
> places where variable was set but not used.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Andrea Claudi <aclaudi@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-18 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-17 17:08 [PATCH iproute2] fix set-not-used warnings Stephen Hemminger
2023-09-18 9:29 ` Andrea Claudi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox