[PATCH] cxl: Simplify bool conversion

Subsystems: char and misc drivers, the rest

STALE2036d LANDED

Landed in mainline as 76ec1ec8fc7c on 2021-02-04.

3 messages, 3 authors, 2021-02-01 · open the first message on its own page

[PATCH] cxl: Simplify bool conversion

From: Yang Li <hidden>
Date: 2021-01-30 23:34:37

Fix the following coccicheck warning:
./drivers/misc/cxl/sysfs.c:181:48-53: WARNING: conversion to bool not
needed here

Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
---
 drivers/misc/cxl/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index d97a243..c173a5e 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -178,7 +178,7 @@ static ssize_t perst_reloads_same_image_store(struct device *device,
 	if ((rc != 1) || !(val == 1 || val == 0))
 		return -EINVAL;
 
-	adapter->perst_same_image = (val == 1 ? true : false);
+	adapter->perst_same_image = (val == 1);
 	return count;
 }
 
-- 
1.8.3.1

Re: [PATCH] cxl: Simplify bool conversion

From: Frederic Barrat <hidden>
Date: 2021-01-29 09:36:43


On 29/01/2021 09:25, Yang Li wrote:
Fix the following coccicheck warning:
./drivers/misc/cxl/sysfs.c:181:48-53: WARNING: conversion to bool not
needed here

Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
---

Thanks!
Acked-by: Frederic Barrat <redacted>

quoted hunk
  drivers/misc/cxl/sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index d97a243..c173a5e 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -178,7 +178,7 @@ static ssize_t perst_reloads_same_image_store(struct device *device,
  	if ((rc != 1) || !(val == 1 || val == 0))
  		return -EINVAL;
  
-	adapter->perst_same_image = (val == 1 ? true : false);
+	adapter->perst_same_image = (val == 1);
  	return count;
  }
  

Re: [PATCH] cxl: Simplify bool conversion

From: Andrew Donnellan <hidden>
Date: 2021-02-01 01:45:40

On 29/1/21 7:25 pm, Yang Li wrote:
Fix the following coccicheck warning:
./drivers/misc/cxl/sysfs.c:181:48-53: WARNING: conversion to bool not
needed here

Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
Reviewed-by: Andrew Donnellan <redacted>

Thanks!
quoted hunk
---
  drivers/misc/cxl/sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index d97a243..c173a5e 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -178,7 +178,7 @@ static ssize_t perst_reloads_same_image_store(struct device *device,
  	if ((rc != 1) || !(val == 1 || val == 0))
  		return -EINVAL;
  
-	adapter->perst_same_image = (val == 1 ? true : false);
+	adapter->perst_same_image = (val == 1);
  	return count;
  }
  
-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help