* [PATCH] x86/mm: Directly return instead of using local ret variable
@ 2022-03-28 2:12 Haowen Bai
2022-03-28 2:49 ` Dave Hansen
2022-03-28 7:49 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: Haowen Bai @ 2022-03-28 2:12 UTC (permalink / raw)
To: dave.hansen, luto, peterz; +Cc: linux-kernel, Haowen Bai
fixes coccinelle warning:
./arch/x86/mm/pf_in.c:133:18-20: Unneeded variable: "rv". Return "OTHERS" on line 144
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
arch/x86/mm/pf_in.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/mm: Directly return instead of using local ret variable
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 ` 答复: " 白浩文
2022-03-28 7:49 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: Dave Hansen @ 2022-03-28 2:49 UTC (permalink / raw)
To: Haowen Bai, dave.hansen, luto, peterz; +Cc: linux-kernel
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'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* 答复: [PATCH] x86/mm: Directly return instead of using local ret variable
2022-03-28 2:49 ` Dave Hansen
@ 2022-03-28 3:02 ` 白浩文
0 siblings, 0 replies; 4+ messages in thread
From: 白浩文 @ 2022-03-28 3:02 UTC (permalink / raw)
To: Dave Hansen, dave.hansen, luto, peterz; +Cc: linux-kernel
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'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/mm: Directly return instead of using local ret variable
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 7:49 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-03-28 7:49 UTC (permalink / raw)
To: Haowen Bai, dave.hansen, luto, peterz
Cc: llvm, kbuild-all, linux-kernel, Haowen Bai
Hi Haowen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/x86/mm]
[also build test ERROR on v5.17 next-20220325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Haowen-Bai/x86-mm-Directly-return-instead-of-using-local-ret-variable/20220328-101514
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git b64dfcde1ca9cb82e38e573753f0c0db8fb841c2
config: i386-randconfig-a014-20220328 (https://download.01.org/0day-ci/archive/20220328/202203281559.hHXuSFrA-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/852ab1aec48033b3a4df180698ab9c29aca0b248
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Haowen-Bai/x86-mm-Directly-return-instead-of-using-local-ret-variable/20220328-101514
git checkout 852ab1aec48033b3a4df180698ab9c29aca0b248
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> arch/x86/mm/pf_in.c:138:2: error: use of undeclared identifier 'rv'
CHECK_OP_TYPE(opcode, reg_rop, REG_READ);
^
arch/x86/mm/pf_in.c:122:4: note: expanded from macro 'CHECK_OP_TYPE'
rv = type; \
^
arch/x86/mm/pf_in.c:139:2: error: use of undeclared identifier 'rv'
CHECK_OP_TYPE(opcode, reg_wop, REG_WRITE);
^
arch/x86/mm/pf_in.c:122:4: note: expanded from macro 'CHECK_OP_TYPE'
rv = type; \
^
arch/x86/mm/pf_in.c:140:2: error: use of undeclared identifier 'rv'
CHECK_OP_TYPE(opcode, imm_wop, IMM_WRITE);
^
arch/x86/mm/pf_in.c:122:4: note: expanded from macro 'CHECK_OP_TYPE'
rv = type; \
^
3 errors generated.
vim +/rv +138 arch/x86/mm/pf_in.c
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 118
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 119 #define CHECK_OP_TYPE(opcode, array, type) \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 120 for (i = 0; i < ARRAY_SIZE(array); i++) { \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 121 if (array[i] == opcode) { \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 122 rv = type; \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 123 goto exit; \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 124 } \
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 125 }
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 126
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 127 enum reason_type get_ins_type(unsigned long ins_addr)
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 128 {
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 129 unsigned int opcode;
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 130 unsigned char *p;
611b1597680dd4a arch/x86/mm/pf_in.c Pekka Paalanen 2008-07-21 131 struct prefix_bits prf;
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 132 int i;
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 133
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 134 p = (unsigned char *)ins_addr;
611b1597680dd4a arch/x86/mm/pf_in.c Pekka Paalanen 2008-07-21 135 p += skip_prefix(p, &prf);
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 136 p += get_opcode(p, &opcode);
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 137
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 @138 CHECK_OP_TYPE(opcode, reg_rop, REG_READ);
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 139 CHECK_OP_TYPE(opcode, reg_wop, REG_WRITE);
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 140 CHECK_OP_TYPE(opcode, imm_wop, IMM_WRITE);
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 141
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 142 exit:
852ab1aec48033b arch/x86/mm/pf_in.c Haowen Bai 2022-03-28 143 return OTHERS;
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 144 }
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 145 #undef CHECK_OP_TYPE
8b7d89d02ef3c6a arch/x86/kernel/mmiotrace/pf_in.c Pekka Paalanen 2008-05-12 146
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-28 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` 答复: " 白浩文
2022-03-28 7:49 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.