net/ice/base: eliminate semantic parser warnings
authorLeyi Rong <leyi.rong@intel.com>
Wed, 19 Jun 2019 15:18:18 +0000 (23:18 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 28 Jun 2019 18:31:48 +0000 (20:31 +0200)
Eliminate some semantic warnings, static analysis warnings.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/base/ice_flex_pipe.c
drivers/net/ice/base/ice_flow.c
drivers/net/ice/base/ice_nvm.c
drivers/net/ice/base/ice_protocol_type.h
drivers/net/ice/base/ice_switch.c
drivers/net/ice/base/ice_type.h

index e3de713..20edc50 100644 (file)
@@ -134,7 +134,7 @@ static struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg)
        nvms = (struct ice_nvm_table *)(ice_seg->device_table +
                LE32_TO_CPU(ice_seg->device_table_count));
 
-       return (struct ice_buf_table *)
+       return (_FORCE_ struct ice_buf_table *)
                (nvms->vers + LE32_TO_CPU(nvms->table_count));
 }
 
@@ -2937,7 +2937,7 @@ static void ice_fill_tbl(struct ice_hw *hw, enum ice_block block_id, u32 sid)
                case ICE_SID_XLT2_ACL:
                case ICE_SID_XLT2_PE:
                        xlt2 = (struct ice_xlt2_section *)sect;
-                       src = (u8 *)xlt2->value;
+                       src = (_FORCE_ u8 *)xlt2->value;
                        sect_len = LE16_TO_CPU(xlt2->count) *
                                sizeof(*hw->blk[block_id].xlt2.t);
                        dst = (u8 *)hw->blk[block_id].xlt2.t;
@@ -3824,7 +3824,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
 
        /* fill in the swap array */
        si = hw->blk[ICE_BLK_FD].es.fvw - 1;
-       do {
+       while (si >= 0) {
                u8 indexes_used = 1;
 
                /* assume flat at this index */
@@ -3856,7 +3856,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
                }
 
                si -= indexes_used;
-       } while (si >= 0);
+       }
 
        /* for each set of 4 swap indexes, write the appropriate register */
        for (j = 0; j < hw->blk[ICE_BLK_FD].es.fvw / 4; j++) {
index 9f3f33c..54da4c0 100644 (file)
@@ -415,9 +415,6 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
                const ice_bitmap_t *src;
                u32 hdrs;
 
-               if (i > 0 && (i + 1) < prof->segs_cnt)
-                       continue;
-
                hdrs = prof->segs[i].hdrs;
 
                if (hdrs & ICE_FLOW_SEG_HDR_ETH) {
index fa9c348..76cfedb 100644 (file)
@@ -127,7 +127,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
 
        status = ice_read_sr_aq(hw, offset, 1, data, true);
        if (!status)
-               *data = LE16_TO_CPU(*(__le16 *)data);
+               *data = LE16_TO_CPU(*(_FORCE_ __le16 *)data);
 
        return status;
 }
@@ -185,7 +185,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)
        } while (words_read < *words);
 
        for (i = 0; i < *words; i++)
-               data[i] = LE16_TO_CPU(((__le16 *)data)[i]);
+               data[i] = LE16_TO_CPU(((_FORCE_ __le16 *)data)[i]);
 
 read_nvm_buf_aq_exit:
        *words = words_read;
index e572dd3..82822fb 100644 (file)
@@ -189,6 +189,7 @@ struct ice_udp_tnl_hdr {
        u16 field;
        u16 proto_type;
        u16 vni;
+       u16 reserved;
 };
 
 struct ice_nvgre {
index 0ffd79d..830025e 100644 (file)
@@ -860,7 +860,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,
                        return ICE_ERR_PARAM;
 
                buf_size = count * sizeof(__le16);
-               mr_list = (__le16 *)ice_malloc(hw, buf_size);
+               mr_list = (_FORCE_ __le16 *)ice_malloc(hw, buf_size);
                if (!mr_list)
                        return ICE_ERR_NO_MEMORY;
                break;
@@ -1460,7 +1460,6 @@ static int ice_ilog2(u64 n)
        return -1;
 }
 
-
 /**
  * ice_fill_sw_rule - Helper function to fill switch rule structure
  * @hw: pointer to the hardware structure
@@ -1480,7 +1479,6 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
        __be16 *off;
        u8 q_rgn;
 
-
        if (opc == ice_aqc_opc_remove_sw_rules) {
                s_rule->pdata.lkup_tx_rx.act = 0;
                s_rule->pdata.lkup_tx_rx.index =
@@ -1556,7 +1554,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
                daddr = f_info->l_data.ethertype_mac.mac_addr;
                /* fall-through */
        case ICE_SW_LKUP_ETHERTYPE:
-               off = (__be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
+               off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
                *off = CPU_TO_BE16(f_info->l_data.ethertype_mac.ethertype);
                break;
        case ICE_SW_LKUP_MAC_VLAN:
@@ -1587,7 +1585,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
                           ICE_NONDMA_TO_NONDMA);
 
        if (!(vlan_id > ICE_MAX_VLAN_ID)) {
-               off = (__be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET);
+               off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET);
                *off = CPU_TO_BE16(vlan_id);
        }
 
index df3c64c..ca88931 100644 (file)
 
 #define BITS_PER_BYTE  8
 
+#ifndef _FORCE_
+#define _FORCE_
+#endif
+
 #define ICE_BYTES_PER_WORD     2
 #define ICE_BYTES_PER_DWORD    4
 #define ICE_MAX_TRAFFIC_CLASS  8
@@ -23,7 +27,7 @@
 #endif
 
 #ifndef IS_ASCII
-#define IS_ASCII(_ch)  ((_ch) < 0x80)
+#define IS_ASCII(_ch)  ((_ch) < 0x80)
 #endif
 
 #include "ice_status.h"
@@ -728,6 +732,7 @@ struct ice_hw {
        u8 pf_id;               /* device profile info */
 
        u16 max_burst_size;     /* driver sets this value */
+
        /* Tx Scheduler values */
        u16 num_tx_sched_layers;
        u16 num_tx_sched_phys_layers;