From patchwork Wed Sep 9 08:45:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 249438 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp208623ilg; Wed, 9 Sep 2020 01:49:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3+Myw3HAtjbTThXezSVVYTXItJRc7nseSd77ORTcLLNou+ErsYP8eoBFiPGbttrdOnkv1 X-Received: by 2002:a17:906:1b11:: with SMTP id o17mr2775373ejg.67.1599641371812; Wed, 09 Sep 2020 01:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599641371; cv=none; d=google.com; s=arc-20160816; b=HFOUN4MlQNP32uL8TPFuPWW9vttMaGxNfbAWq3JDmlUMpaGJrD/6LnbUSiK+DcQZRe 3lKdUpDgozkKYyKS4ciV9x9yYe0NS8yLOHa+WzRwGU1KqNUXtEruaNUPyPl6yhYQEPlw Sll0AodaV58wCBpSMeSgBMG/+2LnJvuPQ5HbSqdw9sKvp9aW/Gahku4NiV9pX/CkgNMZ 9O8EKSX+bE0ijz4yfZBbr/W7/vmXVqglemsaNR0Vh/k5ODTRppIhmblABVDs+cPGej48 m4qL+IGUohyIq+WqAy2SZ00D4wEb378h9haz2wV6gKnSHatks5cN2g+19OOCTgvN9/Y2 gQFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=dPQ04crcZ72kE0O8Oe6HsWAhqD5+2DGrPrVvV3WUUv8=; b=xq+GF5TvMpUyH56n3HgpxjDVxhCWfhKrLKO6saqYbWAjo9alNfie5kURxvmSlzBkwb vgoOv3IczND+Ze513O8ifuCFseuMiAOBQ0N2/AkydFnwVcBWFJYodMS3axGYwzUZKG+y WHVfZ5J0n8L+1NLCRzyYGj8Mcj5kjAyhe9WzKdfV/A3Vcsr5439M7VxTIy+PNW/aWGF5 bWX3JsybpAMwGjjiiHSm/7cZd720UUw4XO7LN1RAsEuZ5o0CVZOSliDwi02i97Si/p7n ExFuA+5jk1XIaPgSEDhNVztsTvFEMVc/r2njeyUycrEzB26J7WhOap5rXZPEtxA8z3dP fsCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si1096334edb.359.2020.09.09.01.49.31; Wed, 09 Sep 2020 01:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727893AbgIIItW (ORCPT + 9 others); Wed, 9 Sep 2020 04:49:22 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:33070 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725826AbgIIItW (ORCPT ); Wed, 9 Sep 2020 04:49:22 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4A5E4A72608B428739F2; Wed, 9 Sep 2020 16:49:19 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Wed, 9 Sep 2020 16:49:09 +0800 From: Wei Xu To: CC: , , , , , , , , , , , , , Jeff Kirsher , Jakub Kicinski , , Subject: [net-next] net: i40e: Use the ARRAY_SIZE macro for aq_to_posix Date: Wed, 9 Sep 2020 16:45:33 +0800 Message-ID: <1599641134-204167-1-git-send-email-xuwei5@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.1 diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h index edec3df..11c5fca 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h @@ -120,7 +120,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc) if (aq_ret == I40E_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];