From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755650AbaLJMtJ (ORCPT ); Wed, 10 Dec 2014 07:49:09 -0500 Received: from mga09.intel.com ([134.134.136.24]:56633 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753999AbaLJMsw (ORCPT ); Wed, 10 Dec 2014 07:48:52 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="496610624" Date: Wed, 10 Dec 2014 20:48:44 +0800 From: kbuild test robot To: Alan Tull Cc: kbuild-all@01.org, Michal Simek , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: fpga manager: fix array_size.cocci warnings Message-ID: <20141210124844.GA32721@waimea> References: <201412102004.fChTGE0W%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201412102004.fChTGE0W%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org drivers/staging/fpga/altera.c:368:33-34: 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: Alan Tull Signed-off-by: Fengguang Wu --- altera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/fpga/altera.c +++ b/drivers/staging/fpga/altera.c @@ -365,7 +365,7 @@ static int altera_fpga_cfg_mode_get(stru msel >>= ALTERA_FPGAMGR_STAT_MSEL_SHIFT; /* Check that this MSEL setting is supported */ - if ((msel >= sizeof(cfgmgr_modes)/sizeof(struct cfgmgr_mode)) || + if ((msel >= ARRAY_SIZE(cfgmgr_modes)) || !cfgmgr_modes[msel].valid) return -EINVAL;