From patchwork Wed Sep 9 08:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 249439 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp212137ilg; Wed, 9 Sep 2020 01:55:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyblE2t1HIsN407l9HqLjOjBbGuWi4+EkS24HV/Tsm+OpPbI2lK1yw4Dq59pG/PB0Ykshvr X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr3088737edb.350.1599641705394; Wed, 09 Sep 2020 01:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599641705; cv=none; d=google.com; s=arc-20160816; b=xESBDbxUpuPAFFfrL3Dy+8nO2R24Bdh0sol12AXgvGt2LCbSiy3RWfluEyh/Fxk/fY TOg2pdKzwCPhi35EH5LA+lVU5JISJgVnsMYdD2OfHCHK0auxNrQV5Sog8gRE3YIdTj5C 5SKAfi5h0dWRXJnOyXlEtI233jpfMga9n/6Ge7/cX0QXyI7IlPvrWLMrNe8H06W6ICW3 i0PrMGMuoJ3YBaZhk4PXzFKwTqGcTyQLpAx0l496282zcH50Um+Vbt71y3ZXMANKU+Rm lLRz5vT3p5TvGuKr5ZY+CMailK31LxLgC58sumal50GE6MhVLjp8aYQ1fhibOqI2mg6L VqGA== 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=gySTwEP0aD1vEZM6p08WgZhyoMQ28XIUHKpk7+q633wqi2RiYUI1JVxsQ7sfu/8Xxr sgbZm5Cp/ucIixMs3kPz/j4QeBGv9hJu4WbWZ6EbotgCrMhBSVMB2y/SDGU7a9VKdqf4 bokrPDYBzD46J67zadrMq/buBQ4yiuWG40f1V0e+iBe4wDWKThU9Tpx7QYxi2fSwrxr2 aiVi2N1mumCfMqhqIrpuulH1IgLESW6OSjHnX0j+/tyQHuVafFXUqA2MVPOzAE4oyucw OWuoGLlsn51Jtm5gGvY+1MWcxNkF0aCWfyMNdUZopxyJqq9Daj/LyTLtGlDxITPP5SDB 5EsQ== 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 yh22si1254016ejb.421.2020.09.09.01.55.05; Wed, 09 Sep 2020 01:55:05 -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 S1729621AbgIIIzA (ORCPT + 9 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 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/iavf/iavf_adminq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.8.1 Tested-by: Konrad Jankowski 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];