Skip to content

Commit feee3cb

Browse files
bwallanJeff Kirsher
authored andcommitted
ice: Silence semantic parser warnings
Recent versions of sparse warn about casting pointers to/from restricted endian types in the Linux driver. Silence those with the compiler attribute __force macro from the Linux kernel to force casts to/from restricted endian types. Signed-off-by: Bruce Allan <[email protected]> Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent aa6ccf3 commit feee3cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/net/ethernet/intel/ice/ice_nvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
119119

120120
status = ice_read_sr_aq(hw, offset, 1, data, true);
121121
if (!status)
122-
*data = le16_to_cpu(*(__le16 *)data);
122+
*data = le16_to_cpu(*(__force __le16 *)data);
123123

124124
return status;
125125
}
@@ -174,7 +174,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)
174174
} while (words_read < *words);
175175

176176
for (i = 0; i < *words; i++)
177-
data[i] = le16_to_cpu(((__le16 *)data)[i]);
177+
data[i] = le16_to_cpu(((__force __le16 *)data)[i]);
178178

179179
read_nvm_buf_aq_exit:
180180
*words = words_read;

drivers/net/ethernet/intel/ice/ice_switch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
799799
daddr = f_info->l_data.ethertype_mac.mac_addr;
800800
/* fall-through */
801801
case ICE_SW_LKUP_ETHERTYPE:
802-
off = (__be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
802+
off = (__force __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET);
803803
*off = cpu_to_be16(f_info->l_data.ethertype_mac.ethertype);
804804
break;
805805
case ICE_SW_LKUP_MAC_VLAN:
@@ -829,7 +829,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
829829
ether_addr_copy(eth_hdr + ICE_ETH_DA_OFFSET, daddr);
830830

831831
if (!(vlan_id > ICE_MAX_VLAN_ID)) {
832-
off = (__be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET);
832+
off = (__force __be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET);
833833
*off = cpu_to_be16(vlan_id);
834834
}
835835

0 commit comments

Comments
 (0)