From: Shuah Khan <skhan@linuxfoundation.org>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests: uevent filtering: fix return on error in uevent_listener
Date: Mon, 18 Sep 2023 11:14:11 -0600 [thread overview]
Message-ID: <3a279a31-7a3b-fed9-e50f-b0d86f4de4f6@linuxfoundation.org> (raw)
In-Reply-To: <20230916-topic-self_uevent_filtering-v1-1-26ede507d454@gmail.com>
On 9/16/23 10:11, Javier Carrasco wrote:
> Assign the error value to the real returned variable fret. The ret
> variable is used to check function return values and assigning values to
> it on error has no effect as it is an unused value.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
> tools/testing/selftests/uevent/uevent_filtering.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/uevent/uevent_filtering.c b/tools/testing/selftests/uevent/uevent_filtering.c
> index 5cebfb356345..e191b6d69f8c 100644
> --- a/tools/testing/selftests/uevent/uevent_filtering.c
> +++ b/tools/testing/selftests/uevent/uevent_filtering.c
> @@ -158,7 +158,7 @@ static int uevent_listener(unsigned long post_flags, bool expect_uevent,
> r = recvmsg(sk_fd, &hdr, 0);
> if (r <= 0) {
> fprintf(stderr, "%s - Failed to receive uevent\n", strerror(errno));
> - ret = -1;
> + fret = -1;
> break;
> }
>
> @@ -172,7 +172,7 @@ static int uevent_listener(unsigned long post_flags, bool expect_uevent,
>
> if (!expect_uevent) {
> fprintf(stderr, "Received unexpected uevent:\n");
> - ret = -1;
> + fret = -1;
> }
>
> if (TH_LOG_ENABLED) {
>
Thank you for the find. Please simplify these leg and use just one
variable for failures, ret or fret and not both to avoid future
coding errors like this one you are fixing.
thanks,
-- Shuah
prev parent reply other threads:[~2023-09-18 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-16 16:11 Javier Carrasco
2023-09-18 17:14 ` Shuah Khan [this message]
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=3a279a31-7a3b-fed9-e50f-b0d86f4de4f6@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@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®