mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: John Hubbard <jhubbard@nvidia.com>,
	Chen Linxuan <chenlinxuan@uniontech.com>
Cc: Shuah Khan <shuah@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>,
	Miklos Szeredi <mszeredi@redhat.com>, Jan Kara <jack@suse.cz>,
	zhanjun@uniontech.com, niecheng1@uniontech.com,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH RESEND] selftests: Suppress unused variable warning
Date: Thu, 19 Jun 2025 15:43:40 -0600	[thread overview]
Message-ID: <4d625aaf-5c8c-4097-897e-a6ebb469c183@linuxfoundation.org> (raw)
In-Reply-To: <f73fa51e-87e5-4805-bbbc-a7af9b50a1d8@linuxfoundation.org>

On 6/19/25 15:40, Shuah Khan wrote:
> On 6/19/25 13:00, John Hubbard wrote:
>> On 6/19/25 10:00 AM, Shuah Khan wrote:
>>> On 6/19/25 01:46, Chen Linxuan wrote:
>>>> On Thu, Jun 19, 2025 at 5:23 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>>>>> On 6/9/25 20:07, Chen Linxuan wrote:
>> ...
>>>>>> diff --git a/tools/testing/selftests/filesystems/mount-notify/mount- notify_test.c b/tools/testing/selftests/filesystems/mount-notify/ mount-notify_test.c
>>>>>> index 63ce708d93ed0..34afe27b7978f 100644
>>>>>> --- a/tools/testing/selftests/filesystems/mount-notify/mount- notify_test.c
>>>>>> +++ b/tools/testing/selftests/filesystems/mount-notify/mount- notify_test.c
>>>>>> @@ -465,7 +465,9 @@ TEST_F(fanotify, rmdir)
>>>>>>        ASSERT_GE(ret, 0);
>>>>>>
>>>>>>        if (ret == 0) {
>>>>>> -             chdir("/");
>>>>>> +             // Suppress -Wunused-result
>>>>>> +             // Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi? id=66425#c34
>>>>>> +             (void) !chdir("/");
>>
>> This is quite ugly. :)
>>
>>>>>>> Why not fix the problem the right way by checking the return value.
>>>>> Suppressing the error isn't useful.
>>>>
>>>> The code is already handling cleanup in error cases,
>>>> and I don't think checking the result of chdir would be useful here.
>>>
>>
>> Why not just fail with the appropriate test result, if chdir() fails
>> here, instead of making a bit of a mess with odd void casts to a
>> negated return value, and a reference to a compiler bug report?
>>
>> Really, Shuah is putting you on the right path here.
> 
> Ha. I didn't ask to suppress the error with the cast. I asked
> to check the return and fail.
> 
>>

Sorry John. I didn't read it correctly the first time.
I probably go get more coffee. :)

thanks,
-- Shuah



  reply	other threads:[~2025-06-19 21:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  2:07 Chen Linxuan
2025-06-18 21:23 ` Shuah Khan
2025-06-19  7:46   ` Chen Linxuan
2025-06-19 17:00     ` Shuah Khan
2025-06-19 19:00       ` John Hubbard
2025-06-19 21:40         ` Shuah Khan
2025-06-19 21:43           ` Shuah Khan [this message]
2025-06-20  2:06           ` Chen Linxuan

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=4d625aaf-5c8c-4097-897e-a6ebb469c183@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chenlinxuan@uniontech.com \
    --cc=jack@suse.cz \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=niecheng1@uniontech.com \
    --cc=shuah@kernel.org \
    --cc=zhanjun@uniontech.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

all inboxes | Powered by JetHome®