From: kbuild test robot <fengguang.wu@intel.com>
To: Alan Tull <atull@opensource.altera.com>
Cc: kbuild-all@01.org, Michal Simek <monstr@monstr.eu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: fpga manager: fix array_size.cocci warnings
Date: Wed, 10 Dec 2014 20:48:44 +0800 [thread overview]
Message-ID: <20141210124844.GA32721@waimea> (raw)
In-Reply-To: <201412102004.fChTGE0W%fengguang.wu@intel.com>
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 <atull@opensource.altera.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
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;
next parent reply other threads:[~2014-12-10 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201412102004.fChTGE0W%fengguang.wu@intel.com>
2014-12-10 12:48 ` kbuild test robot [this message]
2014-12-10 12:48 ` [PATCH] staging: fpga manager: fix platform_no_drv_owner.cocci warnings kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141210124844.GA32721@waimea \
--to=fengguang.wu@intel.com \
--cc=atull@opensource.altera.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox