From nobody Tue Dec 16 04:34:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70935C433FE for ; Sun, 13 Nov 2022 09:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235186AbiKMJSs (ORCPT ); Sun, 13 Nov 2022 04:18:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbiKMJSr (ORCPT ); Sun, 13 Nov 2022 04:18:47 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E7D312A8B for ; Sun, 13 Nov 2022 01:18:37 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 13 Nov 2022 17:13:04 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.167] Date: Sun, 13 Nov 2022 17:13:04 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, Julia.Lawall@inria.fr, joel@jms.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/xmon: Fix array_size.cocci warning X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Message-ID: <6432107b.12b.1847043884e.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXq+EhtXBjzBkDAA--.79W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAEB2FEYx0DfwALsu X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Fix the following coccicheck warning: arch/powerpc/xmon/ppc-opc.c:957:67-68: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:7280:24-25: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:6972:25-26: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:7211:21-22: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang --- arch/powerpc/xmon/ppc-opc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index 0774d711453e..ad64c2709757 100644 --- a/arch/powerpc/xmon/ppc-opc.c +++ b/arch/powerpc/xmon/ppc-opc.c @@ -954,9 +954,7 @@ const struct powerpc_operand powerpc_operands[] =3D { 0xff, 11, NULL, NULL, PPC_OPERAND_SIGNOPT }, }; =20 -const unsigned int num_powerpc_operands =3D (sizeof (powerpc_operands) - / sizeof (powerpc_operands[0])); - +const unsigned int num_powerpc_operands =3D ARRAY_SIZE(powerpc_operands); /* The functions used to insert and extract complicated operands. */ =20 /* The ARX, ARY, RX and RY operands are alternate encodings of GPRs. */ @@ -6968,8 +6966,7 @@ const struct powerpc_opcode powerpc_opcodes[] =3D { {"fcfidu.", XRC(63,974,1), XRA_MASK, POWER7|PPCA2, PPCVLE, {FRT, FRB}}, }; =20 -const int powerpc_num_opcodes =3D - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); +const int powerpc_num_opcodes =3D ARRAY_SIZE(powerpc_opcodes); =0C /* The VLE opcode table. =20 @@ -7207,8 +7204,7 @@ const struct powerpc_opcode vle_opcodes[] =3D { {"se_bl", BD8(58,0,1), BD8_MASK, PPCVLE, 0, {B8}}, }; =20 -const int vle_num_opcodes =3D - sizeof (vle_opcodes) / sizeof (vle_opcodes[0]); +const int vle_num_opcodes =3D ARRAY_SIZE(vle_opcodes); =0C /* The macro table. This is only used by the assembler. */ =20 @@ -7276,5 +7272,4 @@ const struct powerpc_macro powerpc_macros[] =3D { {"e_clrlslwi",4, PPCVLE, "e_rlwinm %0,%1,%3,(%2)-(%3),31-(%3)"}, }; =20 -const int powerpc_num_macros =3D - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); +const int powerpc_num_macros =3D ARRAY_SIZE(powerpc_macros); --=20 2.25.1