linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags'
@ 2020-04-22  7:12 Wu Bo
  2020-04-22  7:52 ` Joseph Qi
  2020-04-24 18:22 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Wu Bo @ 2020-04-22  7:12 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi
  Cc: linux-kernel, ocfs2-devel, liuzhiqiang26, linfeilong, wubo40

Fix the following coccicheck warning:
fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags". 
Return "0" on line 84

Signed-off-by: Wu Bo <wubo40@huawei.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] fs:ocfs2:remove unneeded variable 'o2dlm_flags'
  2020-04-22  7:12 [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags' Wu Bo
@ 2020-04-22  7:52 ` Joseph Qi
  2020-04-22  7:59   ` Wu Bo
  2020-04-24 18:22 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Joseph Qi @ 2020-04-22  7:52 UTC (permalink / raw)
  To: Wu Bo, mark, jlbec; +Cc: linux-kernel, ocfs2-devel, liuzhiqiang26, linfeilong



On 2020/4/22 15:12, Wu Bo wrote:
> Fix the following coccicheck warning:
> fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags". 
> Return "0" on line 84
> 
Umm... This is not right, NAK.
Something tricky is in map_flag() so that coccicheck doesn't recognize.

Thanks,
Joseph

> Signed-off-by: Wu Bo <wubo40@huawei.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: [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags'
  2020-04-22  7:52 ` Joseph Qi
@ 2020-04-22  7:59   ` Wu Bo
  0 siblings, 0 replies; 4+ messages in thread
From: Wu Bo @ 2020-04-22  7:59 UTC (permalink / raw)
  To: Joseph Qi, mark, jlbec
  Cc: linux-kernel, ocfs2-devel, liuzhiqiang26, linfeilong

On 2020/4/22 15:52, Joseph Qi wrote:
> 
> 
> On 2020/4/22 15:12, Wu Bo wrote:
>> Fix the following coccicheck warning:
>> fs/ocfs2/stack_o2cb.c:69:5-16: Unneeded variable: "o2dlm_flags".
>> Return "0" on line 84
>>
> Umm... This is not right, NAK.
> Something tricky is in map_flag() so that coccicheck doesn't recognize.
> 
> Thanks,
> Joseph

You are right. Did not notice that map_flag is a macro, Please ignore 
this patch.

Thanks,
Wu Bo

> 
>> Signed-off-by: Wu Bo <wubo40@huawei.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: [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags'
  2020-04-22  7:12 [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags' Wu Bo
  2020-04-22  7:52 ` Joseph Qi
@ 2020-04-24 18:22 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-04-24 18:22 UTC (permalink / raw)
  To: Wu Bo, mark, jlbec, joseph.qi, linux-kernel, ocfs2-devel,
	liuzhiqiang26, linfeilong
  Cc: kbuild-all, linux-kernel, ocfs2-devel, liuzhiqiang26, linfeilong

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

Hi Wu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.7-rc2 next-20200424]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Wu-Bo/fs-ocfs2-remove-unneeded-variable-o2dlm_flags/20200424-014056
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 18bf34080c4c3beb6699181986cc97dd712498fe
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   fs/ocfs2/stack_o2cb.c: In function 'flags_to_o2dlm':
>> fs/ocfs2/stack_o2cb.c:65:3: error: 'o2dlm_flags' undeclared (first use in this function)
      65 |   o2dlm_flags |= (_o2dlm); \
         |   ^~~~~~~~~~~
>> fs/ocfs2/stack_o2cb.c:69:2: note: in expansion of macro 'map_flag'
      69 |  map_flag(DLM_LKF_NOQUEUE, LKM_NOQUEUE);
         |  ^~~~~~~~
   fs/ocfs2/stack_o2cb.c:65:3: note: each undeclared identifier is reported only once for each function it appears in
      65 |   o2dlm_flags |= (_o2dlm); \
         |   ^~~~~~~~~~~
>> fs/ocfs2/stack_o2cb.c:69:2: note: in expansion of macro 'map_flag'
      69 |  map_flag(DLM_LKF_NOQUEUE, LKM_NOQUEUE);
         |  ^~~~~~~~

vim +/o2dlm_flags +65 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  
54d663085a6a0f Wu Bo       2020-04-22  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  

:::::: The code at line 65 was first introduced by commit
:::::: e3dad42bf993a0f24eb6e46152356c9b119c15e8 ocfs2: Create ocfs2_stack_operations and split out the o2cb stack.

:::::: TO: Joel Becker <joel.becker@oracle.com>
:::::: CC: Mark Fasheh <mfasheh@suse.com>

---
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: 54644 bytes --]

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

end of thread, other threads:[~2020-04-24 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  7:12 [PATCH] fs:ocfs2:remove unneeded variable 'o2dlm_flags' Wu Bo
2020-04-22  7:52 ` Joseph Qi
2020-04-22  7:59   ` Wu Bo
2020-04-24 18:22 ` kbuild test robot

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