From: Andrea Righi <arighi@nvidia.com>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: sched-ext@lists.linux.dev, tj@kernel.org, void@manifault.com,
changwoo@igalia.com, jserv@ccns.ncku.edu.tw
Subject: Re: [PATCH 1/1] selftests/sched_ext: Fix unused-result warning for read()
Date: Sat, 21 Feb 2026 20:37:38 +0100 [thread overview]
Message-ID: <aZoJgm2FS2MPvqyO@gpd4> (raw)
In-Reply-To: <20260221125615.1119571-2-yphbchou0911@gmail.com>
On Sat, Feb 21, 2026 at 08:56:14PM +0800, Cheng-Yang Chou wrote:
> The read() call in run_test() triggers a warn_unused_result compiler
> warning, which breaks the build under -Werror.
>
> Check the return value of read() and exit the child process upon
> failure to satisfy the compiler and prevent unexpected pipe errors.
To be really picky I'd rephrase this part as:
Check the return value of read() and exit the child process on failure to
satisfy the compiler and handle pipe read errors.
"Prevent" suggests avoiding the error, which isn't what the patch does.
But it also looks good as it is.
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Thanks,
-Andrea
>
> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
> tools/testing/selftests/sched_ext/init_enable_count.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/sched_ext/init_enable_count.c b/tools/testing/selftests/sched_ext/init_enable_count.c
> index 82c71653977b..44577e30e764 100644
> --- a/tools/testing/selftests/sched_ext/init_enable_count.c
> +++ b/tools/testing/selftests/sched_ext/init_enable_count.c
> @@ -57,7 +57,8 @@ static enum scx_test_status run_test(bool global)
> char buf;
>
> close(pipe_fds[1]);
> - read(pipe_fds[0], &buf, 1);
> + if (read(pipe_fds[0], &buf, 1) < 0)
> + exit(1);
> close(pipe_fds[0]);
> exit(0);
> }
> --
> 2.48.1
>
next prev parent reply other threads:[~2026-02-21 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-21 12:56 [PATCH 0/1] selftests/sched_ext: Fix unused-result warning for read() Cheng-Yang Chou
2026-02-21 12:56 ` [PATCH 1/1] " Cheng-Yang Chou
2026-02-21 19:37 ` Andrea Righi [this message]
2026-02-22 8:25 ` Cheng-Yang Chou
2026-02-23 17:57 ` [PATCH 0/1] " Tejun Heo
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=aZoJgm2FS2MPvqyO@gpd4 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=jserv@ccns.ncku.edu.tw \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=yphbchou0911@gmail.com \
/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