From mboxrd@z Thu Jan 1 00:00:00 1970 From: kbuild test robot Subject: [PATCH] bnxt_en: fix array_size.cocci warnings Date: Sat, 10 Oct 2015 20:24:22 +0800 Message-ID: <20151010122421.GA58237@ivytown2> References: <201510102046.oAPUHudL%fengguang.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kbuild-all@01.org, davem@davemloft.net, netdev@vger.kernel.org To: Michael Chan Return-path: Received: from mga09.intel.com ([134.134.136.24]:46275 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbbJJMZW (ORCPT ); Sat, 10 Oct 2015 08:25:22 -0400 Content-Disposition: inline In-Reply-To: <1444477151-2225-1-git-send-email-mchan@broadcom.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 Signed-off-by: Fengguang Wu --- 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++) {