Skip to content

Commit

Permalink
selftests/move_mount_set_group remove unneeded conversion to bool
Browse files Browse the repository at this point in the history
The coccinelle report
./tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c:225:18-23:
WARNING: conversion to bool not needed here
Relational and logical operators evaluate to bool,
explicit conversion is overly verbose and unneeded.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Yang Guang authored and Shuah Khan committed Dec 10, 2021
1 parent 6d425d7 commit 009482c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static bool is_shared_mount(const char *path)
#define SET_GROUP_FROM "/tmp/move_mount_set_group_supported_from"
#define SET_GROUP_TO "/tmp/move_mount_set_group_supported_to"

static int move_mount_set_group_supported(void)
static bool move_mount_set_group_supported(void)
{
int ret;

Expand Down Expand Up @@ -222,7 +222,7 @@ static int move_mount_set_group_supported(void)
AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
umount2("/tmp", MNT_DETACH);

return ret < 0 ? false : true;
return ret >= 0;
}

FIXTURE(move_mount_set_group) {
Expand All @@ -232,7 +232,7 @@ FIXTURE(move_mount_set_group) {

FIXTURE_SETUP(move_mount_set_group)
{
int ret;
bool ret;

ASSERT_EQ(prepare_unpriv_mountns(), 0);

Expand All @@ -254,7 +254,7 @@ FIXTURE_SETUP(move_mount_set_group)

FIXTURE_TEARDOWN(move_mount_set_group)
{
int ret;
bool ret;

ret = move_mount_set_group_supported();
ASSERT_GE(ret, 0);
Expand Down Expand Up @@ -348,7 +348,7 @@ TEST_F(move_mount_set_group, complex_sharing_copying)
.shared = false,
};
pid_t pid;
int ret;
bool ret;

ret = move_mount_set_group_supported();
ASSERT_GE(ret, 0);
Expand Down

0 comments on commit 009482c

Please sign in to comment.