From patchwork Sun Nov 13 10:05:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 19334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1625425wru; Sun, 13 Nov 2022 02:23:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf4n1vzyrMMUl5FBLNzGsJzmq5/LhLmKic0x0kbNLZXW432wt6/CXWnMXf55tJpU9pcr6vj+ X-Received: by 2002:a17:906:3fd1:b0:7a6:a48b:5e2a with SMTP id k17-20020a1709063fd100b007a6a48b5e2amr7217777ejj.338.1668334991793; Sun, 13 Nov 2022 02:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668334991; cv=none; d=google.com; s=arc-20160816; b=g47042Le5Y6XOerF3JYK0HPDti9M9TMwUMS8pswBVxBwN+gIiu/OhnLobGTrDP57ME chk1RbWooECx1taeoJvpwTKB2HA9/S/jNILgSgc8k8pL1K1qn71JfflZaK8lu0oD/2Wy JGVKu1cYXJYiVuOAb2EPVaD5folHgcb/v9MM1AGJVR6zMAfqDUm1kYVy/Am8kYuIuh5m dR0eNggNpwPbQSk69tzFqu5IZOcMIJssSGXBiHHw/FUSObHfkahnBvg6oVmGxNM2KFFk 2c1NgafP7Ijm6uZGnHPBjY71la56t+EuD/37eYYNo4v0iftuyCQO/9C2XUDggiJPAQda hLZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:to:from:date; bh=vYEKyDgrwG8Z67sFhU3vbSZQgRfcSIU/cQjhAGZlRFw=; b=N8lcJ/lIFZGSUGobMGk5PesGLJbGroGKn+LEZaH2YQYaEu+zaDQeaVrHrDdrVlhmLq eMXxKTSlwkrJXbbBWRLjZbSEnwKmyS8vpOh2dodysoGhuzMspRZfsnIeL59vIKhFxtg+ 6W2TSgaFOGQntlDsyp9r4jmO2+VDFSnmMe/caDw5pT5I+r7HmTnxRcvkjY0cyTfqLOys XDiqYKBJeAdwvvJ1iW6j7elbdpPQMHbFP52oFN9D1I7KnTpaKTpnCOzcSE1nzc9gIgO/ TZJa3W5+l+yn1XZhqJOrWtmle6dQ7wxifI9lWXMEEkBo801DIqrMJc8vMhzgp/lKtudg djUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a056402038700b00457fc1bcf12si5712982edv.183.2022.11.13.02.22.39; Sun, 13 Nov 2022 02:23:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235085AbiKMKK5 (ORCPT + 99 others); Sun, 13 Nov 2022 05:10:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiKMKK4 (ORCPT ); Sun, 13 Nov 2022 05:10:56 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92F3D5FD7 for ; Sun, 13 Nov 2022 02:10:55 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 13 Nov 2022 18:05:59 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.167] Date: Sun, 13 Nov 2022 18:05:59 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: linux-kernel@vger.kernel.org Subject: [PATCH] tools: 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 MIME-Version: 1.0 Message-ID: <4146c8ae.131.1847073f91a.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwB3jOKHwXBjvx0DAA--.80W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAEB2FEYx0DfwAfs6 X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749376032137405693?= X-GMAIL-MSGID: =?utf-8?q?1749376032137405693?= Fix following coccicheck warning: tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:299:29-30: WARNING: Use ARRAY_SIZE tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:327:30-31: WARNING: Use ARRAY_SIZE tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:367:38-39: WARNING: Use ARRAY_SIZE tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c:372:29-30: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang --- .../ffs-aio-example/multibuff/device_app/aio_multibuff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c index aaca1f44e788..c34dd108658f 100644 --- a/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c +++ b/tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c @@ -296,7 +296,7 @@ int main(int argc, char *argv[]) return 1; } - for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i) + for (i = 0; i < ARRAY_SIZE(iobuf); ++i) init_bufs(&iobuf[i], BUFS_MAX, BUF_LEN); while (1) { @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) * when we're preparing new data to submit, * second buffer being transmitted */ - for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i) { + for (i = 0; i < ARRAY_SIZE(iobuf); ++i) { if (iobuf[i].requested) continue; /* prepare requests */ @@ -364,12 +364,12 @@ int main(int argc, char *argv[]) /* if all req's from iocb completed */ if (!iobuf[actual].requested) - actual = (actual + 1)%(sizeof(iobuf)/sizeof(*iobuf)); + actual = (actual + 1)%(ARRAY_SIZE(iobuf)); } /* free resources */ - for (i = 0; i < sizeof(iobuf)/sizeof(*iobuf); ++i) + for (i = 0; i < ARRAY_SIZE(iobuf); ++i) delete_bufs(&iobuf[i]); io_destroy(ctx);