[ovs-dev] [clang 4/4] Drop assignments whose values are never used.

Ben Pfaff blp at nicira.com
Mon Jul 14 22:00:06 UTC 2014


Found by clang-analyzer.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-actions.c |    6 +++---
 lib/ofp-parse.c   |    6 +++---
 lib/ofp-util.c    |    2 +-
 ofproto/ofproto.c |    1 -
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 9849771..e8fd922 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -1810,8 +1810,8 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow,
 
         ofpact_pad(ofpacts);
         start = ofpbuf_size(ofpacts);
-        on = ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS,
-                        offsetof(struct ofpact_nest, actions));
+        ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS,
+                   offsetof(struct ofpact_nest, actions));
         get_actions_from_instruction(insts[OVSINST_OFPIT11_WRITE_ACTIONS],
                                      &actions, &max_actions);
         error = ofpacts_from_openflow11_for_action_set(actions, max_actions,
@@ -2288,7 +2288,7 @@ ofpact_note_to_nxast(const struct ofpact_note *note, struct ofpbuf *out)
     unsigned int remainder;
     unsigned int len;
 
-    nan = ofputil_put_NXAST_NOTE(out);
+    ofputil_put_NXAST_NOTE(out);
     ofpbuf_set_size(out, ofpbuf_size(out) - sizeof nan->note);
 
     ofpbuf_put(out, note->data, note->length);
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index ff7b9ce..f0a30cf 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -398,7 +398,7 @@ parse_noargs_dec_ttl(struct ofpbuf *b)
     struct ofpact_cnt_ids *ids;
     uint16_t id = 0;
 
-    ids = ofpact_put_DEC_TTL(b);
+    ofpact_put_DEC_TTL(b);
     ofpbuf_put(b, &id, sizeof id);
     ids = b->frame;
     ids->n_controllers++;
@@ -1051,8 +1051,8 @@ parse_named_instruction(enum ovs_instruction_type type,
 
         ofpact_pad(ofpacts);
         ofs = ofpbuf_size(ofpacts);
-        on = ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS,
-                        offsetof(struct ofpact_nest, actions));
+        ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS,
+                   offsetof(struct ofpact_nest, actions));
         error_s = str_to_ofpacts__(arg, ofpacts, usable_protocols);
 
         on = ofpbuf_at_assert(ofpacts, ofs, sizeof *on);
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index a4ee2c2..912def9 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3207,7 +3207,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
 
         msg = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_REMOVED, OFP10_VERSION,
                                htonl(0), NXM_TYPICAL_LEN);
-        nfr = ofpbuf_put_zeros(msg, sizeof *nfr);
+        ofpbuf_put_zeros(msg, sizeof *nfr);
         match_len = nx_put_match(msg, &fr->match, 0, 0);
 
         nfr = ofpbuf_l3(msg);
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 6d0c608..c9a8000 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4856,7 +4856,6 @@ handle_flow_monitor_request(struct ofconn *ofconn, const struct ofp_header *oh)
     struct ofpbuf b;
     size_t i;
 
-    error = 0;
     ofpbuf_use_const(&b, oh, ntohs(oh->length));
     monitors = NULL;
     n_monitors = allocated_monitors = 0;
-- 
1.7.10.4




More information about the dev mailing list