linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] f2fs: Simplify bool conversion
@ 2021-12-15  2:38 Yang Li
  2021-12-16 19:27 ` Jaegeuk Kim
  2021-12-17  1:12 ` [PATCH " Chao Yu
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Li @ 2021-12-15  2:38 UTC (permalink / raw)
  To: jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel, Yang Li, Abaci Robot

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] f2fs: Simplify bool conversion
  2021-12-15  2:38 [PATCH -next] f2fs: Simplify bool conversion Yang Li
@ 2021-12-16 19:27 ` Jaegeuk Kim
       [not found]   ` <fc89c7e6-ced2-40e1-9d01-496a3b60b268.yang.lee@linux.alibaba.com>
  2021-12-17  1:12 ` [PATCH " Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2021-12-16 19:27 UTC (permalink / raw)
  To: Yang Li; +Cc: chao, linux-f2fs-devel, linux-kernel, Abaci Robot

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 <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] f2fs: Simplify bool conversion
  2021-12-15  2:38 [PATCH -next] f2fs: Simplify bool conversion Yang Li
  2021-12-16 19:27 ` Jaegeuk Kim
@ 2021-12-17  1:12 ` Chao Yu
  2021-12-17 16:54   ` Jaegeuk Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Chao Yu @ 2021-12-17  1:12 UTC (permalink / raw)
  To: Yang Li, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Abaci Robot

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 <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

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

Thanks,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 回复:[PATCH -next] f2fs: Simplify bool conversion
       [not found]   ` <fc89c7e6-ced2-40e1-9d01-496a3b60b268.yang.lee@linux.alibaba.com>
@ 2021-12-17 16:51     ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2021-12-17 16:51 UTC (permalink / raw)
  To: Yang.Lee; +Cc: chao, linux-f2fs-devel, linux-kernel, Abaci Robot

On 12/17, Yang.Lee wrote:
> "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.

> 
> 
> ------------------------------------------------------------------
> 发件人:Jaegeuk Kim <jaegeuk@kernel.org>
> 发送时间:2021年12月17日(星期五) 03:27
> 收件人:Yang Li <yang.lee@linux.alibaba.com>
> 抄 送:chao <chao@kernel.org>; linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>; linux-kernel <linux-kernel@vger.kernel.org>; Abaci Robot <abaci@linux.alibaba.com>
> 主 题: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 <abaci@linux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> > ---
> >  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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] f2fs: Simplify bool conversion
  2021-12-17  1:12 ` [PATCH " Chao Yu
@ 2021-12-17 16:54   ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2021-12-17 16:54 UTC (permalink / raw)
  To: Chao Yu; +Cc: Yang Li, linux-f2fs-devel, linux-kernel, Abaci Robot

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 <abaci@linux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> 
> 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,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-17 16:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15  2:38 [PATCH -next] f2fs: Simplify bool conversion Yang Li
2021-12-16 19:27 ` Jaegeuk Kim
     [not found]   ` <fc89c7e6-ced2-40e1-9d01-496a3b60b268.yang.lee@linux.alibaba.com>
2021-12-17 16:51     ` 回复:[PATCH " Jaegeuk Kim
2021-12-17  1:12 ` [PATCH " Chao Yu
2021-12-17 16:54   ` Jaegeuk Kim

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).