public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: remove unneeded variable
@ 2021-11-11  7:53 cgel.zte
  2021-11-11 16:50 ` kernel test robot
  0 siblings, 1 reply; 5+ messages in thread
From: cgel.zte @ 2021-11-11  7:53 UTC (permalink / raw)
  To: agk; +Cc: snitzer, dm-devel, linux-kernel, ran jianping, Zeal Robot

From: ran jianping <ran.jianping@zte.com.cn>

Fix the following coccicheck review:
./drivers/md/dm-ps-round-robin.c:91:5-7:Unneeded variable

Remove unneeded variable used to store return value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
---
 drivers/md/dm-ps-round-robin.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-ps-round-robin.c b/drivers/md/dm-ps-round-robin.c
index 27f44c5fa04e..455fc02af1cf 100644
--- a/drivers/md/dm-ps-round-robin.c
+++ b/drivers/md/dm-ps-round-robin.c
@@ -88,7 +88,6 @@ static int rr_status(struct path_selector *ps, struct dm_path *path,
 		     status_type_t type, char *result, unsigned int maxlen)
 {
 	struct path_info *pi;
-	int sz = 0;
 
 	if (!path)
 		DMEMIT("0 ");
@@ -107,7 +106,7 @@ static int rr_status(struct path_selector *ps, struct dm_path *path,
 		}
 	}
 
-	return sz;
+	return 0;
 }
 
 /*
-- 
2.25.1


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

* Re: [PATCH] dm: remove unneeded variable
  2021-11-11  7:53 cgel.zte
@ 2021-11-11 16:50 ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-11-11 16:50 UTC (permalink / raw)
  To: cgel.zte, agk
  Cc: kbuild-all, snitzer, dm-devel, linux-kernel, ran jianping,
	Zeal Robot

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

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on device-mapper-dm/for-next]
[also build test ERROR on v5.15 next-20211111]
[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/cgel-zte-gmail-com/dm-remove-unneeded-variable/20211111-155437
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: i386-debian-10.3 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/dbcfa76d0a7e2af056369733ed58150e479ec0c7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/dm-remove-unneeded-variable/20211111-155437
        git checkout dbcfa76d0a7e2af056369733ed58150e479ec0c7
        # save the attached .config to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/md/

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

   In file included from drivers/md/dm-ps-round-robin.c:12:
   drivers/md/dm-ps-round-robin.c: In function 'rr_status':
>> include/linux/device-mapper.h:602:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
     602 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
         |                      ^~
   drivers/md/dm-ps-round-robin.c:93:3: note: in expansion of macro 'DMEMIT'
      93 |   DMEMIT("0 ");
         |   ^~~~~~
   include/linux/device-mapper.h:602:22: note: each undeclared identifier is reported only once for each function it appears in
     602 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
         |                      ^~
   drivers/md/dm-ps-round-robin.c:93:3: note: in expansion of macro 'DMEMIT'
      93 |   DMEMIT("0 ");
         |   ^~~~~~


vim +602 include/linux/device-mapper.h

0da336e5fab75c Alasdair G Kergon 2008-04-24  601  
0da336e5fab75c Alasdair G Kergon 2008-04-24 @602  #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
0da336e5fab75c Alasdair G Kergon 2008-04-24  603  			  0 : scnprintf(result + sz, maxlen - sz, x))
0da336e5fab75c Alasdair G Kergon 2008-04-24  604  

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

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

* [PATCH] dm: remove unneeded variable
@ 2023-06-14  2:10 baomingtong001
  2023-06-14  2:42 ` Alasdair G Kergon
  0 siblings, 1 reply; 5+ messages in thread
From: baomingtong001 @ 2023-06-14  2:10 UTC (permalink / raw)
  To: agk, snitzer, dm-devel; +Cc: linux-kernel

fix the following coccicheck warning:



 



drivers/md/dm-snap-persistent.c:909:14-16: Unneeded variable: "sz".



 



Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>



---



drivers/md/dm-snap-persistent.c | 3 +--



1 file changed, 1 insertion(+), 2 deletions(-)



 



diff --git a/drivers/md/dm-snap-persistent.c 
b/drivers/md/dm-snap-persistent.c



index 15649921f2a9..7ea01bceba59 100644



--- a/drivers/md/dm-snap-persistent.c



+++ b/drivers/md/dm-snap-persistent.c



@@ -906,7 +906,6 @@ static unsigned int persistent_status(struct 
dm_exception_store *store,



  status_type_t status, char *result,



  unsigned int maxlen)



{



- unsigned int sz = 0;



switch (status) {



case STATUSTYPE_INFO:



@@ -920,7 +919,7 @@ static unsigned int persistent_status(struct 
dm_exception_store *store,



break;



}



- return sz;



+ return 0;



}



static struct dm_exception_store_type _persistent_type = {



--



2.40.1



 



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

* Re: [PATCH] dm: remove unneeded variable
  2023-06-14  2:10 [PATCH] dm: remove unneeded variable baomingtong001
@ 2023-06-14  2:42 ` Alasdair G Kergon
       [not found]   ` <a78b787e3c45de04df95c80dfc2aa511@208suo.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Alasdair G Kergon @ 2023-06-14  2:42 UTC (permalink / raw)
  To: baomingtong001; +Cc: agk, snitzer, dm-devel, linux-kernel

On Wed, Jun 14, 2023 at 10:10:33AM +0800, baomingtong001@208suo.com wrote:
> fix the following coccicheck warning:
> drivers/md/dm-snap-persistent.c:909:14-16: Unneeded variable: "sz".
 
> - unsigned int sz = 0;
 
> - return sz;
> + return 0;
 
Did the patched code compile OK for you?

The semantics of the DMEMIT macro are perhaps a tad unexpected.

Alasdair


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

* Re: [PATCH] dm: remove unneeded variable
       [not found]   ` <a78b787e3c45de04df95c80dfc2aa511@208suo.com>
@ 2023-06-14 18:48     ` Alasdair G Kergon
  0 siblings, 0 replies; 5+ messages in thread
From: Alasdair G Kergon @ 2023-06-14 18:48 UTC (permalink / raw)
  To: baomingtong001; +Cc: Alasdair G Kergon, snitzer, dm-devel, linux-kernel

On Wed, Jun 14, 2023 at 11:12:19AM +0800, baomingtong001@208suo.com wrote:
>    在 2023-06-14 10:42,Alasdair G Kergon 写道:
> >      Did the patched code compile OK for you?

>    Yes!
 
So what is the definition of DMEMIT that your compiler uses and why?

Alasdair


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

end of thread, other threads:[~2023-06-14 18:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14  2:10 [PATCH] dm: remove unneeded variable baomingtong001
2023-06-14  2:42 ` Alasdair G Kergon
     [not found]   ` <a78b787e3c45de04df95c80dfc2aa511@208suo.com>
2023-06-14 18:48     ` Alasdair G Kergon
  -- strict thread matches above, loose matches on Subject: below --
2021-11-11  7:53 cgel.zte
2021-11-11 16:50 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox