mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wei Xu <xuwei5@hisilicon.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <xuwei5@hisilicon.com>,
	<linuxarm@huawei.com>, <shameerali.kolothum.thodi@huawei.com>,
	<jonathan.cameron@huawei.com>, <john.garry@huawei.com>,
	<salil.mehta@huawei.com>, <shiju.jose@huawei.com>,
	<jinying@hisilicon.com>, <zhangyi.ac@huawei.com>,
	<liguozhu@hisilicon.com>, <tangkunshan@huawei.com>,
	<huangdaode@hisilicon.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Jakub Kicinski <kuba@kernel.org>,
	<intel-wired-lan@lists.osuosl.org>,
	<linux-kernel@vger.kernel.org>
Subject: [net-next] net: iavf: Use the ARRAY_SIZE macro for aq_to_posix
Date: Wed, 9 Sep 2020 16:51:11 +0800	[thread overview]
Message-ID: <1599641471-204919-1-git-send-email-xuwei5@hisilicon.com> (raw)

Use the ARRAY_SIZE macro to calculate the size of an array.
This code was detected with the help of Coccinelle.

Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
 drivers/net/ethernet/intel/iavf/iavf_adminq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.h b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
index baf2fe2..eead12c 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_adminq.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
@@ -120,7 +120,7 @@ static inline int iavf_aq_rc_to_posix(int aq_ret, int aq_rc)
 	if (aq_ret == IAVF_ERR_ADMIN_QUEUE_TIMEOUT)
 		return -EAGAIN;
 
-	if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0]))))
+	if (!((u32)aq_rc < ARRAY_SIZE(aq_to_posix)))
 		return -ERANGE;
 
 	return aq_to_posix[aq_rc];
-- 
2.8.1


             reply	other threads:[~2020-09-09  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09  8:51 Wei Xu [this message]
2020-09-09  9:33 ` Joe Perches
2020-09-09  9:38   ` Joe Perches
2021-01-14  9:57 ` [Intel-wired-lan] " Jankowski, Konrad0
2021-01-14 10:55   ` Joe Perches

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=1599641471-204919-1-git-send-email-xuwei5@hisilicon.com \
    --to=xuwei5@hisilicon.com \
    --cc=davem@davemloft.net \
    --cc=huangdaode@hisilicon.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jinying@hisilicon.com \
    --cc=john.garry@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kuba@kernel.org \
    --cc=liguozhu@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shiju.jose@huawei.com \
    --cc=tangkunshan@huawei.com \
    --cc=zhangyi.ac@huawei.com \
    /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

all inboxes | Powered by JetHome®