* [PATCH] power: supply: Use true and false for bool variable
@ 2021-02-09 9:58 Jiapeng Chong
2021-04-05 10:15 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-02-09 9:58 UTC (permalink / raw)
To: sre; +Cc: linux-pm, linux-kernel, 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.
Reported-by: Abaci Robot<abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
include/linux/power_supply.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 81a55e9..029e6e9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: supply: Use true and false for bool variable
2021-02-09 9:58 [PATCH] power: supply: Use true and false for bool variable Jiapeng Chong
@ 2021-04-05 10:15 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2021-04-05 10:15 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: linux-pm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]
Hi,
On Tue, Feb 09, 2021 at 05:58:43PM +0800, Jiapeng Chong wrote:
> 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.
>
> Reported-by: Abaci Robot<abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
Thanks, queued.
-- Sebastian
> include/linux/power_supply.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 81a55e9..029e6e9 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -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
> --
> 1.8.3.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-05 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 9:58 [PATCH] power: supply: Use true and false for bool variable Jiapeng Chong
2021-04-05 10:15 ` Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.