* [PATCH] tests: remove unneeded conversion to bool
@ 2021-11-25 0:58 davidcomponentone
2021-12-03 18:34 ` Shuah Khan
2021-12-03 18:35 ` Shuah Khan
0 siblings, 2 replies; 3+ messages in thread
From: davidcomponentone @ 2021-11-25 0:58 UTC (permalink / raw)
To: shuah
Cc: davidcomponentone, christian.brauner, ptikhomirov,
linux-kselftest, linux-kernel, Yang Guang, Zeal Robot
From: Yang Guang <yang.guang5@zte.com.cn>
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>
---
.../selftests/move_mount_set_group/move_mount_set_group_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
index 860198f83a53..80ff0b692486 100644
--- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
+++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
@@ -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) {
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: remove unneeded conversion to bool
2021-11-25 0:58 [PATCH] tests: remove unneeded conversion to bool davidcomponentone
@ 2021-12-03 18:34 ` Shuah Khan
2021-12-03 18:35 ` Shuah Khan
1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-12-03 18:34 UTC (permalink / raw)
To: davidcomponentone, shuah
Cc: christian.brauner, ptikhomirov, linux-kselftest, linux-kernel,
Yang Guang, Zeal Robot, Shuah Khan
On 11/24/21 5:58 PM, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> 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>
> ---
> .../selftests/move_mount_set_group/move_mount_set_group_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> index 860198f83a53..80ff0b692486 100644
> --- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> +++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> @@ -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) {
>
In this case it would be better to change the return type for
move_mount_set_group_supported() to bool
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tests: remove unneeded conversion to bool
2021-11-25 0:58 [PATCH] tests: remove unneeded conversion to bool davidcomponentone
2021-12-03 18:34 ` Shuah Khan
@ 2021-12-03 18:35 ` Shuah Khan
1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-12-03 18:35 UTC (permalink / raw)
To: davidcomponentone, shuah
Cc: christian.brauner, ptikhomirov, linux-kselftest, linux-kernel,
Yang Guang, Zeal Robot, Shuah Khan
On 11/24/21 5:58 PM, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> 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>
> ---
> .../selftests/move_mount_set_group/move_mount_set_group_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> index 860198f83a53..80ff0b692486 100644
> --- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> +++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
> @@ -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) {
>
In this case it would be better to change the return type for
move_mount_set_group_supported() to bool
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-03 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 0:58 [PATCH] tests: remove unneeded conversion to bool davidcomponentone
2021-12-03 18:34 ` Shuah Khan
2021-12-03 18:35 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).