netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map
@ 2018-01-07 23:45 Colin King
  2018-01-09 16:41 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-01-07 23:45 UTC (permalink / raw)
  To: Sathya Perla, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
	netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Use the ARRAY_SIZE macro on array cmd_priv_map to determine size of the
array.  Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 02dd5246dfae..1a49297224ed 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -103,7 +103,7 @@ static struct be_cmd_priv_map cmd_priv_map[] = {
 static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, u8 subsystem)
 {
 	int i;
-	int num_entries = sizeof(cmd_priv_map)/sizeof(struct be_cmd_priv_map);
+	int num_entries = ARRAY_SIZE(cmd_priv_map);
 	u32 cmd_privileges = adapter->cmd_privileges;
 
 	for (i = 0; i < num_entries; i++)
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map
  2018-01-07 23:45 [PATCH] be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map Colin King
@ 2018-01-09 16:41 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-09 16:41 UTC (permalink / raw)
  To: colin.king
  Cc: sathya.perla, ajit.khaparde, sriharsha.basavapatna, somnath.kotur,
	netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Sun,  7 Jan 2018 23:45:08 +0000

> From: Colin Ian King <colin.king@canonical.com>
> 
> Use the ARRAY_SIZE macro on array cmd_priv_map to determine size of the
> array.  Improvement suggested by coccinelle.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to net-next.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-09 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-07 23:45 [PATCH] be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map Colin King
2018-01-09 16:41 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).