Skip to contentSkip to conversation

kvm: x86/mmu: Assign boolean values to a bool variable

PATCH New Jiapeng Zhong 1 participant 1 message Jan 21, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: x86/mmu: Assign boolean values to a bool variable

Fix the following coccicheck warnings:

./arch/x86/kvm/mmu/mmu.c:5829:2-9: WARNING: Assignment of 0/1 to bool variable.

./arch/x86/kvm/mmu/mmu.c:2505:1-11: WARNING: Assignment of 0/1 to bool variable.

./arch/x86/kvm/mmu/mmu.c:1814:1-11: WARNING: Assignment of 0/1 to bool variable.

---
 arch/x86/kvm/mmu/mmu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/mmu/mmu.c +4 -4
index 6d16481..ced0bd5 100644
@@ -1819,7 +1819,7 @@ static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
 {
 	WARN_ON(!sp->unsync);
 	trace_kvm_mmu_sync_page(sp);
-	sp->unsync = 0;
+	sp->unsync = false;
 	--kvm->stat.mmu_unsync;
 }
 
@@ -2510,7 +2510,7 @@ static void kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
 {
 	trace_kvm_mmu_unsync_page(sp);
 	++vcpu->kvm->stat.mmu_unsync;
-	sp->unsync = 1;
+	sp->unsync = true;
 
 	kvm_mmu_mark_parents_unsync(sp);
 }
@@ -5839,9 +5839,9 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp)
 
 	/* In "auto" mode deploy workaround only if CPU has the bug. */
 	if (sysfs_streq(val, "off"))
-		new_val = 0;
+		new_val = false;
 	else if (sysfs_streq(val, "force"))
-		new_val = 1;
+		new_val = true;
 	else if (sysfs_streq(val, "auto"))
 		new_val = get_nx_auto_mode();
 	else if (strtobool(val, &new_val) < 0)
Signature · 1 line
1.8.3.1