Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp163869pxk; Wed, 9 Sep 2020 01:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEFlydBoL+YH8c+GR0mQBPvrwVQ8F0ccbWH5ygoNH9kE8jZk6lqW/e0IFM0OukUcGGOev3 X-Received: by 2002:a17:906:2786:: with SMTP id j6mr2548684ejc.73.1599641774392; Wed, 09 Sep 2020 01:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599641774; cv=none; d=google.com; s=arc-20160816; b=tjQwr59wMXRzSriD07dFoh2dwl0Sh+kqxO/MlyJU5ZdK2RNshgvEV8pLNOe/OVZLq0 3quZuc7f5kNYFvLcC8w+0UM2j5XhSnGa6yuPRXMTBBa+OsZAYuOwtawPteCqLIyEqJCY GmoHKclU2jBnvpt/f6E3NEl4uPaJAx+GewYN9QrHFEfoN15g/9k6dTNbPJP/bqT3j7vX I8kITDmnVfE5oP/SH7Fbj/QczAIwgp9TG/jkRgCVr+rDXCrQ8CxBNwhPasKspjLzaluK wSGSMyGgqAvh8xknk1y5roePG7hR1QEEBLpcgdvojxKx9v+rCCW65ulQb7q+fm0JzZDu 6H9g== 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=8XkJhkURKLd6SUG7DIMYwQWkia2XwSRMcrYgtmMUpac=; b=qLl9YlqcbyEPkvnzsoUW2LLMXp4XFNubhnc0XNJFF8id5cgYILMyMWlINizBAJeD+e 8/qKKvDx5n9W6Ui/h4lITWPrTrYqQEwFwCwzID/ECTeU8fesa6kJMlAfoF45a5hz25yq qHyIlyIRq0A6fI+9j39dzMPEnUbrhW60Fl9c8fWIc/iS4AELbA8xl3JMTxYE13k/aU1U rklvACPtTW10Fx1sCZgR1EUBp0VvkXPEISLPV2LLRaS5CROJgPkp+rXSfP2ZCtFFwvfX agy0osefL1DImJHiJKW9Tm60YlgzdvvBT01AyT3urR7/u5srelgt2f05MQN4oflzzguD 8Piw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 k17si1039694ejc.412.2020.09.09.01.55.51; Wed, 09 Sep 2020 01:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729622AbgIIIzA (ORCPT + 99 others); Wed, 9 Sep 2020 04:55:00 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11290 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726408AbgIIIy5 (ORCPT ); Wed, 9 Sep 2020 04:54:57 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CABAE1E26E649B123902; Wed, 9 Sep 2020 16:54:55 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Wed, 9 Sep 2020 16:54:45 +0800 From: Wei Xu To: CC: , , , , , , , , , , , , , Jeff Kirsher , Jakub Kicinski , , Subject: [net-next] net: iavf: Use the ARRAY_SIZE macro for aq_to_posix Date: Wed, 9 Sep 2020 16:51:11 +0800 Message-ID: <1599641471-204919-1-git-send-email-xuwei5@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/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