selftests: cgroup: Fixes code style errors
PATCH 1/1 selftests: cgroup: Fixes code style errors
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 <[email protected]>
--- tools/testing/selftests/cgroup/cgroup_util.c | 14 ++++++++------ tools/testing/selftests/cgroup/test_core.c | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-)
tools/testing/selftests/cgroup/cgroup_util.c +8 -6
@@ -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); static int clone_into_cgroup_run_nowait(const char *cgroup, int (*fn)(const char *cgroup, void *arg),
tools/testing/selftests/cgroup/test_core.c +2 -1
@@ -817,7 +817,8 @@ static int test_cgcore_lesser_ns_open(const char *root)if (cg_enter_current (cg_test_a)) goto cleanup; -if ((status =write (cg_test_b_procs_fd,"0" ,1 )) >=0 || errno !=ENOENT ) + status =write (cg_test_b_procs_fd,"0" ,1 ); +if (status >=0 || errno !=ENOENT ) goto cleanup; ret =KSFT_PASS ;
Signature · 1 line
2.25.1
Shuah Khan
maintainerQuoted 22 lines · Atul Kumar Pant
Fixes following checkpatch.pl issues:
ERROR: do not use assignment in if condition
ERROR: Macros starting with if should be enclosed by a do - whileSigned-off-by Atul Kumar Pant <[email protected]>--- tools/testing/selftests/cgroup/cgroup_util.c | 14 ++++++++------ tools/testing/selftests/cgroup/test_core.c | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-)tools/testing/selftests/cgroup/cgroup_util.c +0
-4@@ -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); \
tools/testing/selftests/cgroup/cgroup_util.c int dirfd_open_opath(const char *dir) · line 421
Quoted 10 lines
tools/testing/selftests/cgroup/cgroup_util.c +8
-2- 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