Re: [PATCH 0/8] Fix -Wunused-result warnings by checking return values

John Kacur
2025-07-25T18:17:01Z

On Sat, 12 Jul 2025, Cheng-Yang Chou wrote:

> This patch series adds proper error checking to functions such as write(),
> ftruncate(), and system(), whose return values were previously ignored.
>
> These warnings were treated as errors under -Werror due to the
> __attribute__((warn_unused_result)) annotation. Instead of suppressing
> them with compiler flags, this series addresses each call site directly
> to improve code robustness and clarity.
>
> A full list of compiler warnings fixed in this series is available at:
> https://gist.github.com/EricccTaiwan/a78d6f1950d3cba27be757e405b6626a
>
> Tested on Ubuntu 25.04 (GCC 14.2.0, glibc 2.41).
>
> Thanks.
>
> -chengyang
>
> ---
>
> Cheng-Yang Chou (8):
> rt-utils.c: Suppress warning
> pmqtest.c: Suppress warning
> ptsematest.c: Suppress warning
> rt-migrate-test.c: Suppress warning
> cyclicdeadline.c: Suppress warning
> deadline_test.c: Suppress warning
> sigwaittest.c: Suppress warning
> svsematest.c: Suppress warning
>
> src/lib/rt-utils.c | 9 +++++--
> src/pmqtest/pmqtest.c | 6 ++++-
> src/ptsematest/ptsematest.c | 6 ++++-
> src/rt-migrate-test/rt-migrate-test.c | 5 +++-
> src/sched_deadline/cyclicdeadline.c | 32 +++++++++++++++++++----
> src/sched_deadline/deadline_test.c | 37 +++++++++++++++++++++++----
> src/sigwaittest/sigwaittest.c | 13 ++++++++--
> src/svsematest/svsematest.c | 13 ++++++++--
> 8 files changed, 102 insertions(+), 19 deletions(-)
>
> --
> 2.48.1
>
>
>

The code is generally okay, but I noticed after I signed off on a few,
that none of your commits have commit messages.

Please run checkpatch from the kernel on your patches and fix the
appropriate warnings and resend.

John Kacur