Skip to contentSkip to conversation

cxl: Simplify bool conversion

PATCH In review Yang Li 3 participants 3 messages Jan 29, 2021 – Feb 1, 2021 Char and misc drivers

lore
Share & tools
lore
Acked-by on v1 1/1
#1 lore raw
In reply to Yang Li
Quoted 7 lines · Yang Li

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

---

Thanks!

Quoted 17 lines
  drivers/misc/cxl/sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/sysfs.c +1 -1
index d97a243..c173a5e 100644
@@ -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;
  }
 

Yang Li

author
#0 lore raw

PATCH 1/1 cxl: Simplify bool conversion

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

---
 drivers/misc/cxl/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/sysfs.c +1 -1
index d97a243..c173a5e 100644
@@ -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;
 }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 6 lines · Yang Li

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

Thanks!

Quoted 18 lines
---
  drivers/misc/cxl/sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/sysfs.c +1 -1
index d97a243..c173a5e 100644
@@ -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;
  }
 
Signature · 2 lines
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]             IBM Australia Limited