From: wangkailong@jari.cn
To: linux-kernel@vger.kernel.org
Subject: [PATCH] tools: fix array_size.cocci warning
Date: Sun, 13 Nov 2022 18:05:59 +0800 (GMT+08:00) [thread overview]
Message-ID: <4146c8ae.131.1847073f91a.Coremail.wangkailong@jari.cn> (raw)
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 <wangkailong@jari.cn>
---
.../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);
--
2.25.1
reply other threads:[~2022-11-13 10:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4146c8ae.131.1847073f91a.Coremail.wangkailong@jari.cn \
--to=wangkailong@jari.cn \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®