linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: i8254: remove redundant assignment to pointer s
@ 2020-06-09 23:31 Colin King
  2020-06-10  8:32 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-06-09 23:31 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H . Peter Anvin, kvm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The pointer s is being assigned a value that is never read, the
assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 arch/x86/kvm/i8254.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index febca334c320..a6e218c6140d 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -462,7 +462,6 @@ static int pit_ioport_write(struct kvm_vcpu *vcpu,
 		if (channel == 3) {
 			/* Read-Back Command. */
 			for (channel = 0; channel < 3; channel++) {
-				s = &pit_state->channels[channel];
 				if (val & (2 << channel)) {
 					if (!(val & 0x20))
 						pit_latch_count(pit, channel);
-- 
2.27.0.rc0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm: i8254: remove redundant assignment to pointer s
  2020-06-09 23:31 [PATCH] kvm: i8254: remove redundant assignment to pointer s Colin King
@ 2020-06-10  8:32 ` Vitaly Kuznetsov
  0 siblings, 0 replies; 2+ messages in thread
From: Vitaly Kuznetsov @ 2020-06-10  8:32 UTC (permalink / raw)
  To: Colin King
  Cc: kernel-janitors, linux-kernel, Paolo Bonzini,
	Sean Christopherson, Wanpeng Li, Jim Mattson, Joerg Roedel,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H . Peter Anvin, kvm

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer s is being assigned a value that is never read, the
> assignment is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

It seems it wasn't used since the very beginning,

Fixes: 7837699fa6d7 ("KVM: In kernel PIT model")

QEMU code (from where KVM's implementation originates), however, 
does make use of 's' here as it open codes pit_latch_status().

> ---
>  arch/x86/kvm/i8254.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index febca334c320..a6e218c6140d 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -462,7 +462,6 @@ static int pit_ioport_write(struct kvm_vcpu *vcpu,
>  		if (channel == 3) {
>  			/* Read-Back Command. */
>  			for (channel = 0; channel < 3; channel++) {
> -				s = &pit_state->channels[channel];
>  				if (val & (2 << channel)) {
>  					if (!(val & 0x20))
>  						pit_latch_count(pit, channel);

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-10  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 23:31 [PATCH] kvm: i8254: remove redundant assignment to pointer s Colin King
2020-06-10  8:32 ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).