l2: coverity woe in l2_rw_mod_entry 95/31495/2
authorSteven Luong <sluong@cisco.com>
Thu, 4 Mar 2021 00:56:19 +0000 (16:56 -0800)
committerDamjan Marion <dmarion@me.com>
Fri, 5 Mar 2021 10:50:48 +0000 (10:50 +0000)
Coverity complains that the statement
 if (!e)
   return -1;
is never true and is logically dead code in the subject function. It is
right. e is assigned in both the if and else statementes immediately above
and can never be null.

Type: fix

Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: Ic2d0e76eff696ee689a68a07913876dcecf5c647

src/vnet/l2/l2_rw.c

index a7c95fe..b6de2fa 100644 (file)
@@ -326,9 +326,6 @@ l2_rw_mod_entry (u32 * index,
       *index = e - rw->entries;
     }
 
-  if (!e)
-    return -1;
-
   if (is_del)
     {
       pool_put (rw->entries, e);