Skip to contentSkip to conversation

power: supply: Use true and false for bool variable

PATCH In review Jiapeng Chong 2 participants 2 messages Feb 9, 2021 – Apr 5, 2021 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: Use true and false for bool variable

Fix the following coccicheck warning:

./include/linux/power_supply.h:507:9-10: WARNING: return of 0/1 in function 'power_supply_is_watt_property' with return type bool.

./include/linux/power_supply.h:479:9-10: WARNING: return of 0/1 in function 'power_supply_is_amp_property' with return type bool.

---
 include/linux/power_supply.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/power_supply.h +4 -4
index 81a55e9..029e6e9 100644
@@ -476,12 +476,12 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 	case POWER_SUPPLY_PROP_CURRENT_AVG:
 	case POWER_SUPPLY_PROP_CURRENT_BOOT:
-		return 1;
+		return true;
 	default:
 		break;
 	}
 
-	return 0;
+	return false;
 }
 
 static inline bool power_supply_is_watt_property(enum power_supply_property psp)
@@ -504,12 +504,12 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
 	case POWER_SUPPLY_PROP_POWER_NOW:
-		return 1;
+		return true;
 	default:
 		break;
 	}
 
-	return 0;
+	return false;
 }
 
 #ifdef CONFIG_POWER_SUPPLY_HWMON
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

Quoted 11 lines · Jiapeng Chong

Fix the following coccicheck warning:

./include/linux/power_supply.h:507:9-10: WARNING: return of 0/1 in function 'power_supply_is_watt_property' with return type bool.

./include/linux/power_supply.h:479:9-10: WARNING: return of 0/1 in function 'power_supply_is_amp_property' with return type bool.

---

Thanks, queued.

-- Sebastian

Quoted 40 lines
 include/linux/power_supply.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/power_supply.h +4 -4
index 81a55e9..029e6e9 100644
@@ -476,12 +476,12 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 	case POWER_SUPPLY_PROP_CURRENT_AVG:
 	case POWER_SUPPLY_PROP_CURRENT_BOOT:
-		return 1;
+		return true;
 	default:
 		break;
 	}
 
-	return 0;
+	return false;
 }
 
 static inline bool power_supply_is_watt_property(enum power_supply_property psp)
@@ -504,12 +504,12 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
 	case POWER_SUPPLY_PROP_POWER_NOW:
-		return 1;
+		return true;
 	default:
 		break;
 	}
 
-	return 0;
+	return false;
 }
 
 #ifdef CONFIG_POWER_SUPPLY_HWMON
Signature · 1 line
1.8.3.1