Skip to contentSkip to conversation

KVM: x86: remove set but not used variable 'called'

PATCH Superseded Mao Wenan 5 participants 14 messages Nov 19, 2019 – Nov 22, 2019

Subsystems (4)
lore
Share & tools
lore

Mao Wenan

author
#0 lore raw

PATCH 1/1 KVM: x86: remove set but not used variable 'called'

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

---
 arch/x86/kvm/x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +2 -3
index 0d0a682..870f0bc 100644
@@ -7908,12 +7908,11 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
 				       unsigned long *vcpu_bitmap)
 {
 	cpumask_var_t cpus;
-	bool called;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);
 
-	called = kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
-					     vcpu_bitmap, cpus);
+	kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
+				    vcpu_bitmap, cpus);
 
 	free_cpumask_var(cpus);
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")
Quoted 12 lines
---
 arch/x86/kvm/x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +0 -0
index 0d0a682..870f0bc 100644
@@ -7908,12 +7908,11 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
 				       unsigned long *vcpu_bitmap)

arch/x86/kvm/x86.c void kvm_make_scan_ioapic_request_mask(struct kvm *kvm, · line 7915

Quoted 10 lines
arch/x86/kvm/x86.c +2 -3
 {
 	cpumask_var_t cpus;
-	bool called;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);
 
-	called = kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
-					     vcpu_bitmap, cpus);
+	kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
+				    vcpu_bitmap, cpus);

IMHO as kvm_make_vcpus_request_mask() returns value it would probably make sense to explicitly show that we're not interested in the result,

(void)kvm_make_vcpus_request_mask()

Quoted 3 lines
arch/x86/kvm/x86.c +0 -0
 	free_cpumask_var(cpus);
 }
Signature · 1 line
Vitaly
#2 lore raw
Quoted 8 lines · Vitaly Kuznetsov
Quoted 6 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

Quoted 7 lines
Quoted 2 lines

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

regards,
dan carpenter

#3 lore raw
Quoted 12 lines · Dan Carpenter
Quoted 11 lines · Vitaly Kuznetsov
Quoted 8 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Quoted 8 lines
Quoted 4 lines

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

I have to admit I'm involved in doing backporting sometimes and I really appreciate Fixes: tags. Just so you know on which side of the debate I am :-)

Signature · 1 line
Vitaly
#4 lore raw
Quoted 19 lines · Vitaly Kuznetsov
Quoted 17 lines · Dan Carpenter
Quoted 15 lines · Vitaly Kuznetsov
Quoted 8 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")
Quoted 7 lines
Quoted 3 lines

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

I have to admit I'm involved in doing backporting sometimes and I really appreciate Fixes: tags. Just so you know on which side of the debate I am :-)

But we're not going to backport this hopefully?

regards,
dan carpenter

#5 lore raw
Quoted 24 lines · Dan Carpenter
Quoted 23 lines · Vitaly Kuznetsov
Quoted 20 lines · Dan Carpenter
Quoted 8 lines · Vitaly Kuznetsov
Quoted 6 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

Quoted 7 lines
Quoted 2 lines

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

Quoted 6 lines
Quoted 3 lines

I have to admit I'm involved in doing backporting sometimes and I really appreciate Fixes: tags. Just so you know on which side of the debate I am :-)

But we're not going to backport this hopefully?

In case we're speaking about stable@ kernels, 7ee30bc132c6 doesn't look like a good candidate (to me) but who knows, it may get pulled in because of some code dependency or some other 'autosel magic'. And that's when 'Fixes:' tags become handy.

Signature · 1 line
Vitaly
#6 lore raw
Quoted 26 lines · Vitaly Kuznetsov
Quoted 24 lines · Dan Carpenter
Quoted 23 lines · Vitaly Kuznetsov
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Vitaly Kuznetsov
Quoted 6 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

I have to admit I'm involved in doing backporting sometimes and I really appreciate Fixes: tags. Just so you know on which side of the debate I am :-)

Quoted 6 lines
Quoted 2 lines

But we're not going to backport this hopefully?

In case we're speaking about stable@ kernels, 7ee30bc132c6 doesn't look like a good candidate (to me) but who knows, it may get pulled in because of some code dependency or some other 'autosel magic'. And that's when 'Fixes:' tags become handy.

Anything I can improve upon? If required I can send fixes on top of it. For the build error, I didn't trigger it because I didn't compile with appropriate flags.
I will make a note for myself for next time.

Thanks, Mao for sending the fix.

Quoted 1 line
Signature · 1 line
Nitesh
#7 lore raw
Quoted 2 lines · Nitesh Narayan Lal

For the build error, I didn't trigger it because I didn't compile with appropriate flags.

It's going to be a serveral years before we can enable that flag by default.

regards,
dan carpenter

#8 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 2 lines · Nitesh Narayan Lal

For the build error, I didn't trigger it because I didn't compile with appropriate flags.

It's going to be a serveral years before we can enable that flag by default.

I see I have made a note of it so that I can do it before sending the patches.

Quoted 3 lines

regards,
dan carpenter

Signature · 2 lines
Thanks
Nitesh
maintainer
#9 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter
Quoted 3 lines

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

There is sort of a debate about this whether the Fixes tag should be used if it's only a cleanup.

The other debate is whether this is a cleanup, since the build is broken with -Werror. I agree that code cleanups generally don't deserve Fixes tags, but this patch IMHO does.

Paolo

author
#10 lore raw

shall we send v2 with fixes tag?

Quoted 1 line · Paolo Bonzini

atch IMHO does.

author
#11 lore raw

PATCH v2 1/1 KVM: x86: remove set but not used variable 'called'

In reply to Paolo Bonzini

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

---
v2: add fixes tag since Paolo and Vitaly proposal.

 arch/x86/kvm/x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +2 -3
index 0d0a682..870f0bc 100644
@@ -7908,12 +7908,11 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
 				       unsigned long *vcpu_bitmap)
 {
 	cpumask_var_t cpus;
-	bool called;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);
 
-	called = kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
-					     vcpu_bitmap, cpus);
+	kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
+				    vcpu_bitmap, cpus);
 
 	free_cpumask_var(cpus);
 }
Signature · 1 line
2.7.4
author
#12 lore raw
In reply to Vitaly Kuznetsov
Quoted 8 lines · Vitaly Kuznetsov
Quoted 6 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

Quoted 6 lines
Quoted 2 lines

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

This is just a cleanup, so Fixes tag is no need.

Quoted 27 lines
Quoted 13 lines
---
 arch/x86/kvm/x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +0 -0
index 0d0a682..870f0bc 100644
@@ -7908,12 +7908,11 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
 				       unsigned long *vcpu_bitmap)

arch/x86/kvm/x86.c void kvm_make_scan_ioapic_request_mask(struct kvm *kvm, · line 7915

Quoted 10 lines
arch/x86/kvm/x86.c +2 -3
 {
 	cpumask_var_t cpus;
-	bool called;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);
 
-	called = kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
-					     vcpu_bitmap, cpus);
+	kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
+				    vcpu_bitmap, cpus);

IMHO as kvm_make_vcpus_request_mask() returns value it would probably make sense to explicitly show that we're not interested in the result,

Quoted 1 line

(void)kvm_make_vcpus_request_mask()

thanks, but I think is no need to add (void) before kvm_make_vcpus_request_mask() because we are not interested in it's return value.

Quoted 5 lines
Quoted 4 lines
arch/x86/kvm/x86.c +0 -0
 	free_cpumask_var(cpus);
 }
#13 lore raw
Quoted 9 lines · maowenan
Quoted 8 lines · Vitaly Kuznetsov
Quoted 6 lines · Mao Wenan

Fixes gcc '-Wunused-but-set-variable' warning:

arch/x86/kvm/x86.c: In function kvm_make_scan_ioapic_request_mask:
arch/x86/kvm/x86.c:7911:7: warning: variable called set but not used [-Wunused-but-set-variable]

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

It is not used since commit 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

Better expressed as

Fixes 7ee30bc132c6 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")

This is just a cleanup, so Fixes tag is no need.

Quoted 1 line

Just a cleanup -- unless we compile with '-Werror'.

Quoted 26 lines
Quoted 26 lines
Quoted 12 lines
---
 arch/x86/kvm/x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +0 -0
index 0d0a682..870f0bc 100644
@@ -7908,12 +7908,11 @@ void kvm_make_scan_ioapic_request_mask(struct kvm *kvm,
 				       unsigned long *vcpu_bitmap)

arch/x86/kvm/x86.c void kvm_make_scan_ioapic_request_mask(struct kvm *kvm, · line 7915

Quoted 10 lines
arch/x86/kvm/x86.c +2 -3
 {
 	cpumask_var_t cpus;
-	bool called;
 
 	zalloc_cpumask_var(&cpus, GFP_ATOMIC);
 
-	called = kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
-					     vcpu_bitmap, cpus);
+	kvm_make_vcpus_request_mask(kvm, KVM_REQ_SCAN_IOAPIC,
+				    vcpu_bitmap, cpus);

IMHO as kvm_make_vcpus_request_mask() returns value it would probably make sense to explicitly show that we're not interested in the result,

Quoted 4 lines
Quoted 1 line

(void)kvm_make_vcpus_request_mask()

thanks, but I think is no need to add (void) before kvm_make_vcpus_request_mask() because we are not interested in it's return value.

Hm, that's exactly the reason why I suggested adding it there :-) Not a big deal, feel free to ignore.

Signature · 1 line
Vitaly