The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Atul Kumar Pant <atulpant.linux@gmail.com>,
	tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
	shuah@kernel.org
Cc: cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v1] selftests: cgroup: Fixes code style errors
Date: Thu, 30 Nov 2023 16:46:35 -0700	[thread overview]
Message-ID: <e13a07f6-d251-4510-aa3a-3a90583bd404@linuxfoundation.org> (raw)
In-Reply-To: <20231106181144.117188-1-atulpant.linux@gmail.com>

On 11/6/23 11:11, Atul Kumar Pant wrote:
> Fixes following checkpatch.pl issues:
> ERROR: do not use assignment in if condition
> ERROR: Macros starting with if should be enclosed by a do - while
> 
> Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
> ---
>   tools/testing/selftests/cgroup/cgroup_util.c | 14 ++++++++------
>   tools/testing/selftests/cgroup/test_core.c   |  3 ++-
>   2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
> index 0340d4ca8f51..e165c4a703a6 100644
> --- a/tools/testing/selftests/cgroup/cgroup_util.c
> +++ b/tools/testing/selftests/cgroup/cgroup_util.c
> @@ -411,12 +411,14 @@ int dirfd_open_opath(const char *dir)
>   	return open(dir, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW | O_PATH);
>   }
>   
> -#define close_prot_errno(fd)                                                   \
> -	if (fd >= 0) {                                                         \
> -		int _e_ = errno;                                               \
> -		close(fd);                                                     \
> -		errno = _e_;                                                   \
> -	}
> +#define close_prot_errno(fd)				\
> +	do {						\
> +		if (fd >= 0) {                          \
> +			int _e_ = errno;                \
> +			close(fd);                      \
> +			errno = _e_;                    \
> +		}					\
> +	} while (0);

Did you run checkpatch on this patch? You are fixing
checkpatch errors - :)

thanks,
-- Shuah

      reply	other threads:[~2023-11-30 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 18:11 [PATCH v1] selftests: cgroup: Fixes code style errors Atul Kumar Pant
2023-11-30 23:46 ` 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=e13a07f6-d251-4510-aa3a-3a90583bd404@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=atulpant.linux@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=shuah@kernel.org \
    --cc=tj@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