From: Jules Irenge <[email protected]>
Coccinelle reports a warning inside sched_energy_aware_handler()
WARNING: Assignment of 0/1 to bool variable
To fix this, 1 is replaced by true and 0 by false.
Given that variable sched_energy_update is of bool type.
This fixes the warnings.
Signed-off-by: Jules Irenge <[email protected]>
---
kernel/sched/topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index dfb64c08a407..9d70cc68e549 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -221,9 +221,9 @@ int sched_energy_aware_handler(struct ctl_table *table, int write,
state = static_branch_unlikely(&sched_energy_present);
if (state != sysctl_sched_energy_aware) {
mutex_lock(&sched_energy_mutex);
- sched_energy_update = 1;
+ sched_energy_update = true;
rebuild_sched_domains();
- sched_energy_update = 0;
+ sched_energy_update = false;
mutex_unlock(&sched_energy_mutex);
}
}
--
2.25.1
On Fri, Mar 27, 2020 at 09:23:49PM +0000, Jules Irenge wrote:
> From: Jules Irenge <[email protected]>
>
> Coccinelle reports a warning inside sched_energy_aware_handler()
>
> WARNING: Assignment of 0/1 to bool variable
That's definitely not a warning and quite sensible in any case. Please
learn C.
On Mon, 30 Mar 2020, Peter Zijlstra wrote:
> On Fri, Mar 27, 2020 at 09:23:49PM +0000, Jules Irenge wrote:
>> From: Jules Irenge <[email protected]>
>>
>> Coccinelle reports a warning inside sched_energy_aware_handler()
>>
>> WARNING: Assignment of 0/1 to bool variable
>
> That's definitely not a warning and quite sensible in any case. Please
> learn C.
Thanks for the reply, I think I took the warning literally. I will take
the advice any way.
Thanks,
Jules