drivers/net/ethernet/broadcom/bnxt/bnxt.c:2773:41-42: WARNING: Use ARRAY_SIZE
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element Semantic patch information: This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Generated by: scripts/coccinelle/misc/array_size.cocci CC: Michael Chan <mc...@broadcom.com> Signed-off-by: Fengguang Wu <fengguang...@intel.com> --- bnxt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2770,8 +2770,7 @@ static int bnxt_hwrm_func_drv_rgtr(struc u32 *data = (u32 *)vf_req_snif_bmap; memset(vf_req_snif_bmap, 0, 32); - for (i = 0; i < sizeof(bnxt_vf_req_snif) / - sizeof(bnxt_vf_req_snif[0]); i++) + for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++) __set_bit(bnxt_vf_req_snif[i], vf_req_snif_bmap); for (i = 0; i < 8; i++) { -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html