ocfs2: Remove unneeded return variable
PATCH 1/1 ocfs2: Remove unneeded return variable
This patch removes unneeded return variables, using only '0' instead.
It fixes the following warning detected by coccinelle:
./fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags". Return "0" on line 84
--- fs/ocfs2/stack_o2cb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ocfs2/stack_o2cb.c +1 -3
@@ -66,8 +66,6 @@ static inline int mode_to_o2dlm(int mode) }static int flags_to_o2dlm (u32 flags) { -int o2dlm_flags =0 ; -map_flag (DLM_LKF_NOQUEUE ,LKM_NOQUEUE );map_flag (DLM_LKF_CANCEL ,LKM_CANCEL );map_flag (DLM_LKF_CONVERT ,LKM_CONVERT );
@@ -81,7 +79,7 @@ static int flags_to_o2dlm(u32 flags)/* map_flag() should have cleared every flag passed in */ BUG_ON (flags !=0 ); -return o2dlm_flags; +return 0 ; }#undef map_flag
Signature · 1 line
1.8.3.1
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Yang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.11-rc6 next-20210125]
[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/0day-ci/linux/commits/Yang-Li/ocfs2-Remove-unneeded-return-variable/20210204-111516 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 61556703b610a104de324e4f061dc6cf7b218b46 config: riscv-randconfig-r023-20210203 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 275c6af7d7f1ed63a03d05b4484413e447133269)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/5bb80175fa7cb498c4ed06c376ea16b672477df7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/ocfs2-Remove-unneeded-return-variable/20210204-111516 git checkout 5bb80175fa7cb498c4ed06c376ea16b672477df7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> fs/ocfs2/stack_o2cb.c:69:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_NOQUEUE, LKM_NOQUEUE);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:70:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_CANCEL, LKM_CANCEL);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:71:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_CONVERT, LKM_CONVERT);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:72:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_VALBLK, LKM_VALBLK);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:73:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_IVVALBLK, LKM_INVVALBLK);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:74:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_ORPHAN, LKM_ORPHAN);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:75:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_FORCEUNLOCK, LKM_FORCE);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:76:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_TIMEOUT, LKM_TIMEOUT);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^
fs/ocfs2/stack_o2cb.c:77:2: error: use of undeclared identifier 'o2dlm_flags'
map_flag(DLM_LKF_LOCAL, LKM_LOCAL);
^
fs/ocfs2/stack_o2cb.c:65:3: note: expanded from macro 'map_flag'
o2dlm_flags |= (_o2dlm); \
^9 errors generated.
vim +/o2dlm_flags +69 fs/ocfs2/stack_o2cb.c
e3dad42bf993a0 Joel Becker 2008-02-01 61
e3dad42bf993a0 Joel Becker 2008-02-01 62 #define map_flag(_generic, _o2dlm) \
e3dad42bf993a0 Joel Becker 2008-02-01 63 if (flags & (_generic)) { \
e3dad42bf993a0 Joel Becker 2008-02-01 64 flags &= ~(_generic); \
e3dad42bf993a0 Joel Becker 2008-02-01 65 o2dlm_flags |= (_o2dlm); \
e3dad42bf993a0 Joel Becker 2008-02-01 66 }
e3dad42bf993a0 Joel Becker 2008-02-01 67 static int flags_to_o2dlm(u32 flags)
e3dad42bf993a0 Joel Becker 2008-02-01 68 {
e3dad42bf993a0 Joel Becker 2008-02-01 @69 map_flag(DLM_LKF_NOQUEUE, LKM_NOQUEUE);
e3dad42bf993a0 Joel Becker 2008-02-01 70 map_flag(DLM_LKF_CANCEL, LKM_CANCEL);
e3dad42bf993a0 Joel Becker 2008-02-01 71 map_flag(DLM_LKF_CONVERT, LKM_CONVERT);
e3dad42bf993a0 Joel Becker 2008-02-01 72 map_flag(DLM_LKF_VALBLK, LKM_VALBLK);
e3dad42bf993a0 Joel Becker 2008-02-01 73 map_flag(DLM_LKF_IVVALBLK, LKM_INVVALBLK);
e3dad42bf993a0 Joel Becker 2008-02-01 74 map_flag(DLM_LKF_ORPHAN, LKM_ORPHAN);
e3dad42bf993a0 Joel Becker 2008-02-01 75 map_flag(DLM_LKF_FORCEUNLOCK, LKM_FORCE);
e3dad42bf993a0 Joel Becker 2008-02-01 76 map_flag(DLM_LKF_TIMEOUT, LKM_TIMEOUT);
e3dad42bf993a0 Joel Becker 2008-02-01 77 map_flag(DLM_LKF_LOCAL, LKM_LOCAL);
e3dad42bf993a0 Joel Becker 2008-02-01 78
e3dad42bf993a0 Joel Becker 2008-02-01 79 /* map_flag() should have cleared every flag passed in */
e3dad42bf993a0 Joel Becker 2008-02-01 80 BUG_ON(flags != 0);
e3dad42bf993a0 Joel Becker 2008-02-01 81
5bb80175fa7cb4 Yang Li 2021-02-04 82 return 0;
e3dad42bf993a0 Joel Becker 2008-02-01 83 }
e3dad42bf993a0 Joel Becker 2008-02-01 84 #undef map_flag
e3dad42bf993a0 Joel Becker 2008-02-01 85 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
NAK.
This was discussed before, please refer:
https://oss.oracle.com/pipermail/ocfs2-devel/2020-April/014969.html
Thanks,
Joseph
Quoted 35 lines · Yang Li
This patch removes unneeded return variables, using only '0' instead.
It fixes the following warning detected by coccinelle:
./fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags". Return "0" on line 84Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- fs/ocfs2/stack_o2cb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/ocfs2/stack_o2cb.c +1
-3@@ -66,8 +66,6 @@ static inline int mode_to_o2dlm(int mode) }static int flags_to_o2dlm (u32 flags) { -int o2dlm_flags =0 ; -map_flag (DLM_LKF_NOQUEUE ,LKM_NOQUEUE );map_flag (DLM_LKF_CANCEL ,LKM_CANCEL );map_flag (DLM_LKF_CONVERT ,LKM_CONVERT );@@ -81,7 +79,7 @@ static int flags_to_o2dlm(u32 flags)/* map_flag() should have cleared every flag passed in */ BUG_ON (flags !=0 ); -return o2dlm_flags; +return 0 ; }#undef map_flag
Actually I think the macro of map_flag() is ugly. Yang may want to fix that first.
Thanks,
Wengang
Quoted 37 lines · Joseph Qi
NAK.
This was discussed before, please refer:
https://oss.oracle.com/pipermail/ocfs2-devel/2020-April/014969.htmlThanks,
JosephQuoted 29 lines · Yang Li
This patch removes unneeded return variables, using only '0' instead.
It fixes the following warning detected by coccinelle:
./fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags". Return "0" on line 84Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- fs/ocfs2/stack_o2cb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/ocfs2/stack_o2cb.c +0
-2@@ -66,8 +66,6 @@ static inline int mode_to_o2dlm(int mode) }static int flags_to_o2dlm (u32 flags) { -int o2dlm_flags =0 ; -map_flag (DLM_LKF_NOQUEUE ,LKM_NOQUEUE );map_flag (DLM_LKF_CANCEL ,LKM_CANCEL );map_flag (DLM_LKF_CONVERT ,LKM_CONVERT );@@ -81,7 +79,7 @@ static int flags_to_o2dlm(u32 flags)/* map_flag() should have cleared every flag passed in */ BUG_ON (flags !=0 );
Quoted 10 lines
fs/ocfs2/stack_o2cb.c static int flags_to_o2dlm(u32 flags) · line 85
Quoted 6 lines
fs/ocfs2/stack_o2cb.c +1
-1-return o2dlm_flags; +return 0 ; }#undef map_flag_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel
_______________________________________________
Ocfs2-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/ocfs2-devel