]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
bnxt: simplify cls_flower command switch and handle default case
authorJiri Pirko <jiri@mellanox.com>
Sun, 24 Jun 2018 08:38:37 +0000 (10:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Jun 2018 07:14:03 +0000 (16:14 +0900)
Currently the default case is not handled, which with future command
introductions would introduce a warning. So handle it and make the
switch a bit simplier removing unneeded "rc" variable.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c

index 795f45024c209e65591a3e9fe60814315ebb3cb0..d0699f39ba346442c1d067e273bf688680bfd103 100644 (file)
@@ -1544,22 +1544,16 @@ void bnxt_tc_flow_stats_work(struct bnxt *bp)
 int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
                         struct tc_cls_flower_offload *cls_flower)
 {
-       int rc = 0;
-
        switch (cls_flower->command) {
        case TC_CLSFLOWER_REPLACE:
-               rc = bnxt_tc_add_flow(bp, src_fid, cls_flower);
-               break;
-
+               return bnxt_tc_add_flow(bp, src_fid, cls_flower);
        case TC_CLSFLOWER_DESTROY:
-               rc = bnxt_tc_del_flow(bp, cls_flower);
-               break;
-
+               return bnxt_tc_del_flow(bp, cls_flower);
        case TC_CLSFLOWER_STATS:
-               rc = bnxt_tc_get_flow_stats(bp, cls_flower);
-               break;
+               return bnxt_tc_get_flow_stats(bp, cls_flower);
+       default:
+               return -EOPNOTSUPP;
        }
-       return rc;
 }
 
 static const struct rhashtable_params bnxt_tc_flow_ht_params = {