linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: Remove unneeded return variable
@ 2021-02-04  3:12 Yang Li
  2021-02-04  4:22 ` kernel test robot
  2021-02-04  5:12 ` Joseph Qi
  0 siblings, 2 replies; 4+ messages in thread
From: Yang Li @ 2021-02-04  3:12 UTC (permalink / raw)
  To: mark; +Cc: jlbec, joseph.qi, ocfs2-devel, linux-kernel, 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 84

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 fs/ocfs2/stack_o2cb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
index dbf8b57..2da9633 100644
--- a/fs/ocfs2/stack_o2cb.c
+++ b/fs/ocfs2/stack_o2cb.c
@@ -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
 
-- 
1.8.3.1


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

* Re: [PATCH] ocfs2: Remove unneeded return variable
  2021-02-04  3:12 [PATCH] ocfs2: Remove unneeded return variable Yang Li
@ 2021-02-04  4:22 ` kernel test robot
  2021-02-04  5:12 ` Joseph Qi
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-02-04  4:22 UTC (permalink / raw)
  To: Yang Li, mark
  Cc: kbuild-all, clang-built-linux, jlbec, joseph.qi, ocfs2-devel,
	linux-kernel, Yang Li

[-- Attachment #1: Type: text/plain, Size: 6116 bytes --]

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
Reported-by: kernel test robot <lkp@intel.com>

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@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39026 bytes --]

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

* Re: [PATCH] ocfs2: Remove unneeded return variable
  2021-02-04  3:12 [PATCH] ocfs2: Remove unneeded return variable Yang Li
  2021-02-04  4:22 ` kernel test robot
@ 2021-02-04  5:12 ` Joseph Qi
  2021-02-04 16:28   ` [Ocfs2-devel] " Wengang Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Joseph Qi @ 2021-02-04  5:12 UTC (permalink / raw)
  To: Yang Li
  Cc: jlbec, ocfs2-devel, linux-kernel, mark@fasheh.com >> Mark Fasheh

NAK.
This was discussed before, please refer:
https://oss.oracle.com/pipermail/ocfs2-devel/2020-April/014969.html

Thanks,
Joseph

On 2/4/21 11:12 AM, Yang Li wrote:
> 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
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  fs/ocfs2/stack_o2cb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
> index dbf8b57..2da9633 100644
> --- a/fs/ocfs2/stack_o2cb.c
> +++ b/fs/ocfs2/stack_o2cb.c
> @@ -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
>  
> 

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

* Re: [Ocfs2-devel] [PATCH] ocfs2: Remove unneeded return variable
  2021-02-04  5:12 ` Joseph Qi
@ 2021-02-04 16:28   ` Wengang Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Wengang Wang @ 2021-02-04 16:28 UTC (permalink / raw)
  To: Joseph Qi, Yang Li; +Cc: ocfs2-devel, linux-kernel

Actually I think the macro of map_flag() is ugly. Yang may want to fix 
that first.

Thanks,
Wengang

On 2/3/21 9:12 PM, Joseph Qi wrote:
> NAK.
> This was discussed before, please refer:
> https://oss.oracle.com/pipermail/ocfs2-devel/2020-April/014969.html
>
> Thanks,
> Joseph
>
> On 2/4/21 11:12 AM, Yang Li wrote:
>> 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
>>
>> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
>> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
>> ---
>>   fs/ocfs2/stack_o2cb.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c
>> index dbf8b57..2da9633 100644
>> --- a/fs/ocfs2/stack_o2cb.c
>> +++ b/fs/ocfs2/stack_o2cb.c
>> @@ -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
>>   
>>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel

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

end of thread, other threads:[~2021-02-04 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  3:12 [PATCH] ocfs2: Remove unneeded return variable Yang Li
2021-02-04  4:22 ` kernel test robot
2021-02-04  5:12 ` Joseph Qi
2021-02-04 16:28   ` [Ocfs2-devel] " Wengang Wang

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).