2021-12-15 02:39:05

by Yang Li

[permalink] [raw]
Subject: [PATCH -next] f2fs: Simplify bool conversion

Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
fs/f2fs/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 9e1cf44642ae..530c36b89bf1 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -488,7 +488,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,

if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) {
spin_lock(&sbi->gc_urgent_high_lock);
- sbi->gc_urgent_high_limited = t == 0 ? false : true;
+ sbi->gc_urgent_high_limited = t != 0;
sbi->gc_urgent_high_remaining = t;
spin_unlock(&sbi->gc_urgent_high_lock);

--
2.20.1.7.g153144c



2021-12-16 19:27:46

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH -next] f2fs: Simplify bool conversion

On 12/15, Yang Li wrote:
> Fix the following coccicheck warning:
> ./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>
> ---
> fs/f2fs/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 9e1cf44642ae..530c36b89bf1 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -488,7 +488,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
>
> if (!strcmp(a->attr.name, "gc_urgent_high_remaining")) {
> spin_lock(&sbi->gc_urgent_high_lock);
> - sbi->gc_urgent_high_limited = t == 0 ? false : true;
> + sbi->gc_urgent_high_limited = t != 0;

Why not this?
sbi->gc_urgent_high_limited = t;

> sbi->gc_urgent_high_remaining = t;
> spin_unlock(&sbi->gc_urgent_high_lock);
>
> --
> 2.20.1.7.g153144c

2021-12-17 01:12:42

by Chao Yu

[permalink] [raw]
Subject: Re: [PATCH -next] f2fs: Simplify bool conversion

On 2021/12/15 10:38, Yang Li wrote:
> Fix the following coccicheck warning:
> ./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>

Thanks for fixing this issue, do you mind merging this fix into original patch?

Thanks,

2021-12-17 16:54:09

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH -next] f2fs: Simplify bool conversion

On 12/17, Chao Yu wrote:
> On 2021/12/15 10:38, Yang Li wrote:
> > Fix the following coccicheck warning:
> > ./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here
> >
> > Reported-by: Abaci Robot <[email protected]>
> > Signed-off-by: Yang Li <[email protected]>
>
> Thanks for fixing this issue, do you mind merging this fix into original patch?

I applied this separately in order to avoid huge rebase.

>
> Thanks,