Linux Kernel Mentees Archive mirror
 help / color / mirror / Atom feed
From: "José Pekkarinen" <jose.pekkarinen@foxhound.fi>
To: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	skhan@linuxfoundation.org
Cc: x86@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org, hpa@zytor.com
Subject: Re: [PATCH] KVM: x86: cleanup unused variables
Date: Sun, 29 Oct 2023 14:26:22 +0200	[thread overview]
Message-ID: <411f0a96b86c08e85a02c7174a921138@foxhound.fi> (raw)
In-Reply-To: <20231029093859.138442-1-jose.pekkarinen@foxhound.fi>

On 2023-10-29 11:38, José Pekkarinen wrote:
> Reported by coccinelle, the following patch will remove some
> redundant variables. This patch will address the following
> warnings:
> 
> arch/x86/kvm/emulate.c:1315:5-7: Unneeded variable: "rc". Return
> "X86EMUL_CONTINUE" on line 1330
> arch/x86/kvm/emulate.c:4557:5-7: Unneeded variable: "rc". Return
> "X86EMUL_CONTINUE" on line 4591
> arch/x86/kvm/emulate.c:1180:5-7: Unneeded variable: "rc". Return
> "X86EMUL_CONTINUE" on line 1202
> 
> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> ---
>  arch/x86/kvm/emulate.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2673cd5c46cb..c4bb03a88dfe 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -1177,7 +1177,6 @@ static int decode_modrm(struct x86_emulate_ctxt 
> *ctxt,
>  {
>  	u8 sib;
>  	int index_reg, base_reg, scale;
> -	int rc = X86EMUL_CONTINUE;
>  	ulong modrm_ea = 0;
> 
>  	ctxt->modrm_reg = ((ctxt->rex_prefix << 1) & 8); /* REX.R */
> @@ -1199,16 +1198,16 @@ static int decode_modrm(struct x86_emulate_ctxt 
> *ctxt,
>  			op->bytes = 16;
>  			op->addr.xmm = ctxt->modrm_rm;
>  			kvm_read_sse_reg(ctxt->modrm_rm, &op->vec_val);
> -			return rc;
> +			return X86EMUL_CONTINUE;
>  		}
>  		if (ctxt->d & Mmx) {
>  			op->type = OP_MM;
>  			op->bytes = 8;
>  			op->addr.mm = ctxt->modrm_rm & 7;
> -			return rc;
> +			return X86EMUL_CONTINUE;
>  		}
>  		fetch_register_operand(op);
> -		return rc;
> +		return X86EMUL_CONTINUE;
>  	}
> 
>  	op->type = OP_MEM;
> @@ -1306,14 +1305,12 @@ static int decode_modrm(struct x86_emulate_ctxt 
> *ctxt,
>  		ctxt->memop.addr.mem.ea = (u32)ctxt->memop.addr.mem.ea;
> 
>  done:
> -	return rc;
> +	return X86EMUL_CONTINUE;
>  }
> 
>  static int decode_abs(struct x86_emulate_ctxt *ctxt,
>  		      struct operand *op)
>  {
> -	int rc = X86EMUL_CONTINUE;
> -
>  	op->type = OP_MEM;
>  	switch (ctxt->ad_bytes) {
>  	case 2:
> @@ -1327,7 +1324,7 @@ static int decode_abs(struct x86_emulate_ctxt 
> *ctxt,
>  		break;
>  	}
>  done:
> -	return rc;
> +	return X86EMUL_CONTINUE;
>  }
> 
>  static void fetch_bit_operand(struct x86_emulate_ctxt *ctxt)
> @@ -4554,8 +4551,6 @@ static unsigned imm_size(struct x86_emulate_ctxt 
> *ctxt)
>  static int decode_imm(struct x86_emulate_ctxt *ctxt, struct operand 
> *op,
>  		      unsigned size, bool sign_extension)
>  {
> -	int rc = X86EMUL_CONTINUE;
> -
>  	op->type = OP_IMM;
>  	op->bytes = size;
>  	op->addr.mem.ea = ctxt->_eip;
> @@ -4588,7 +4583,7 @@ static int decode_imm(struct x86_emulate_ctxt
> *ctxt, struct operand *op,
>  		}
>  	}
>  done:
> -	return rc;
> +	return X86EMUL_CONTINUE;
>  }
> 
>  static int decode_operand(struct x86_emulate_ctxt *ctxt, struct 
> operand *op,

     Sorry, this is a false positive, please skip it.

     José.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2023-10-29 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29  9:38 [PATCH] KVM: x86: cleanup unused variables José Pekkarinen
2023-10-29 12:26 ` José Pekkarinen [this message]
2023-10-29 18:41 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411f0a96b86c08e85a02c7174a921138@foxhound.fi \
    --to=jose.pekkarinen@foxhound.fi \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).