public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: 白浩文 <baihaowen@meizu.com>
To: Dave Hansen <dave.hansen@intel.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"luto@kernel.org" <luto@kernel.org>,
	"peterz@infradead.org" <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [PATCH] x86/mm: Directly return instead of using local ret variable
Date: Mon, 28 Mar 2022 03:02:02 +0000	[thread overview]
Message-ID: <b1f92ed707eb469aa626fe0be03eaf96@meizu.com> (raw)
In-Reply-To: <347c75b8-3a48-0758-892a-0d0ac139f740@intel.com>

Thank you for pointing my mistaken.
________________________________________
发件人: Dave Hansen <dave.hansen@intel.com>
发送时间: 2022年3月28日 10:49:19
收件人: 白浩文; dave.hansen@linux.intel.com; luto@kernel.org; peterz@infradead.org
抄送: linux-kernel@vger.kernel.org
主题: Re: [PATCH] x86/mm: Directly return instead of using local ret variable

On 3/27/22 19:12, Haowen Bai wrote:
>
> diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
> index 3f83e31..4eff3ee 100644
> --- a/arch/x86/mm/pf_in.c
> +++ b/arch/x86/mm/pf_in.c
> @@ -130,7 +130,6 @@ enum reason_type get_ins_type(unsigned long ins_addr)
>       unsigned char *p;
>       struct prefix_bits prf;
>       int i;
> -     enum reason_type rv = OTHERS;
>
>       p = (unsigned char *)ins_addr;
>       p += skip_prefix(p, &prf);
> @@ -141,7 +140,7 @@ enum reason_type get_ins_type(unsigned long ins_addr)
>       CHECK_OP_TYPE(opcode, imm_wop, IMM_WRITE);
>
>  exit:
> -     return rv;
> +     return OTHERS;
>  }
>  #undef CHECK_OP_TYPE
>

Does this even compile?  Take a look at this macro:

> #define CHECK_OP_TYPE(opcode, array, type) \
>         for (i = 0; i < ARRAY_SIZE(array); i++) { \
>                 if (array[i] == opcode) { \
>                         rv = type; \
>                         goto exit; \
>                 } \

It uses 'rv'.


  reply	other threads:[~2022-03-28  3:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  2:12 [PATCH] x86/mm: Directly return instead of using local ret variable Haowen Bai
2022-03-28  2:49 ` Dave Hansen
2022-03-28  3:02   ` 白浩文 [this message]
2022-03-28  7:49 ` 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=b1f92ed707eb469aa626fe0be03eaf96@meizu.com \
    --to=baihaowen@meizu.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.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