f2fs: Simplify bool conversion
PATCH 1/1 f2fs: Simplify bool conversion
Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed here
--- fs/f2fs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/sysfs.c +1 -1
@@ -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);
Signature · 1 line
2.20.1.7.g153144c
Jaegeuk Kim
maintainerQuoted 14 lines · Yang Li
Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed hereReported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- fs/f2fs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/sysfs.c +0
-0
fs/f2fs/sysfs.c static ssize_t __sbi_store(struct f2fs_attr *a, · line 491
Quoted 5 lines
fs/f2fs/sysfs.c +1
-1@@ -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;
Quoted 5 lines
fs/f2fs/sysfs.c +0
-0sbi->gc_urgent_high_remaining = t;spin_unlock (&sbi->gc_urgent_high_lock);Signature · 1 line
2.20.1.7.g153144c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jaegeuk Kim
maintainerQuoted 4 lines · Yang.Lee
"Why not this?
sbi->gc_urgent_high_limited= t;"Since 't' is an unsigned long type and '
gc_urgent_high_limited' is a bool type, the assignment operation will cause a new warning.
Huh, that doesn't allow auto casting as well.
Quoted 39 lines
------------------------------------------------------------------
发件人:Jaegeuk Kim <[email protected]>
发送时间:2021年12月17日(星期五) 03:27
收件人:Yang Li <[email protected]>
抄 送:chao <[email protected]>; linux-f2fs-devel <[email protected]>; linux-kernel <[email protected]>; Abaci Robot <[email protected]> 主 题:Re: [PATCH -next] f2fs: Simplify bool conversionQuoted 14 lines · Yang Li
Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed hereReported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- fs/f2fs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/sysfs.c +0
-0fs/f2fs/sysfs.c static ssize_t __sbi_store(struct f2fs_attr *a, · line 491
Quoted 5 lines
fs/f2fs/sysfs.c +1
-1@@ -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;Quoted 5 lines
fs/f2fs/sysfs.c +0
-0sbi->gc_urgent_high_remaining = t;spin_unlock (&sbi->gc_urgent_high_lock);Signature · 1 line
2.20.1.7.g153144c
Chao Yu
maintainerQuoted 5 lines · Yang Li
Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed hereReported-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,
Quoted 8 lines · Chao Yu
Quoted 5 lines · Yang Li
Fix the following coccicheck warning:
./fs/f2fs/sysfs.c:491:41-46: WARNING: conversion to bool not needed hereReported-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.
Quoted 2 lines
Thanks,