public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz'
@ 2019-12-01  5:42 Jieun Kim
  2019-12-01  7:46 ` kbuild test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Jieun Kim @ 2019-12-01  5:42 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Alasdair Kergon, dm-devel, linux-kernel, kernel-janitors,
	Jieun Kim

Remove unused variable 'sz' in core_status function
detected by coccinelle scripts(returnvar.cocci)

Signed-off-by: Jieun Kim <Jieun.Kim4758@gmail.com>
---
 drivers/md/dm-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 33e71ea6cc14..8800ec1847b5 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -781,7 +781,6 @@ static region_t core_get_sync_count(struct dm_dirty_log *log)
 static int core_status(struct dm_dirty_log *log, status_type_t status,
 		       char *result, unsigned int maxlen)
 {
-	int sz = 0;
 	struct log_c *lc = log->context;
 
 	switch(status) {
@@ -795,7 +794,7 @@ static int core_status(struct dm_dirty_log *log, status_type_t status,
 		DMEMIT_SYNC;
 	}
 
-	return sz;
+	return 0;
 }
 
 static int disk_status(struct dm_dirty_log *log, status_type_t status,
-- 
2.17.1


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

* Re: [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz'
  2019-12-01  5:42 [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz' Jieun Kim
@ 2019-12-01  7:46 ` kbuild test robot
  2019-12-02 17:39   ` Mike Snitzer
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2019-12-01  7:46 UTC (permalink / raw)
  To: Jieun Kim
  Cc: kbuild-all, Mike Snitzer, Alasdair Kergon, dm-devel, linux-kernel,
	kernel-janitors, Jieun Kim

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

Hi Jieun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on dm/for-next]
[also build test ERROR on v5.4 next-20191129]
[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/Jieun-Kim/drivers-md-dm-log-c-Remove-unused-variable-sz/20191201-134548
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: i386-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-1) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

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

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

   In file included from include/linux/dm-dirty-log.h:16:0,
                    from drivers/md/dm-log.c:13:
   drivers/md/dm-log.c: In function 'core_status':
>> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
    #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
                         ^
>> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
      DMEMIT("1 %s", log->type->name);
      ^~~~~~
   include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
    #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
                         ^
>> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
      DMEMIT("1 %s", log->type->name);
      ^~~~~~
--
   In file included from include/linux/dm-dirty-log.h:16:0,
                    from drivers//md/dm-log.c:13:
   drivers//md/dm-log.c: In function 'core_status':
>> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
    #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
                         ^
   drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
      DMEMIT("1 %s", log->type->name);
      ^~~~~~
   include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
    #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
                         ^
   drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
      DMEMIT("1 %s", log->type->name);
      ^~~~~~

vim +/DMEMIT +788 drivers/md/dm-log.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  776  
^1da177e4c3f41 Linus Torvalds     2005-04-16  777  #define	DMEMIT_SYNC \
^1da177e4c3f41 Linus Torvalds     2005-04-16  778  	if (lc->sync != DEFAULTSYNC) \
^1da177e4c3f41 Linus Torvalds     2005-04-16  779  		DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
^1da177e4c3f41 Linus Torvalds     2005-04-16  780  
416cd17b198221 Heinz Mauelshagen  2008-04-24  781  static int core_status(struct dm_dirty_log *log, status_type_t status,
^1da177e4c3f41 Linus Torvalds     2005-04-16  782  		       char *result, unsigned int maxlen)
^1da177e4c3f41 Linus Torvalds     2005-04-16  783  {
^1da177e4c3f41 Linus Torvalds     2005-04-16  784  	struct log_c *lc = log->context;
^1da177e4c3f41 Linus Torvalds     2005-04-16  785  
^1da177e4c3f41 Linus Torvalds     2005-04-16  786  	switch(status) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  787  	case STATUSTYPE_INFO:
315dcc226f066c Jonathan E Brassow 2007-05-09 @788  		DMEMIT("1 %s", log->type->name);
^1da177e4c3f41 Linus Torvalds     2005-04-16  789  		break;
^1da177e4c3f41 Linus Torvalds     2005-04-16  790  
^1da177e4c3f41 Linus Torvalds     2005-04-16  791  	case STATUSTYPE_TABLE:
^1da177e4c3f41 Linus Torvalds     2005-04-16  792  		DMEMIT("%s %u %u ", log->type->name,
^1da177e4c3f41 Linus Torvalds     2005-04-16  793  		       lc->sync == DEFAULTSYNC ? 1 : 2, lc->region_size);
^1da177e4c3f41 Linus Torvalds     2005-04-16  794  		DMEMIT_SYNC;
^1da177e4c3f41 Linus Torvalds     2005-04-16  795  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  796  
2a79ee10b97355 Jieun Kim          2019-12-01  797  	return 0;
^1da177e4c3f41 Linus Torvalds     2005-04-16  798  }
^1da177e4c3f41 Linus Torvalds     2005-04-16  799  

:::::: The code at line 788 was first introduced by commit
:::::: 315dcc226f066c1d3cef79283dcde807fe0e32d1 dm log: report fault status

:::::: TO: Jonathan E Brassow <jbrassow@redhat.com>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

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

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

* Re: [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz'
  2019-12-01  7:46 ` kbuild test robot
@ 2019-12-02 17:39   ` Mike Snitzer
  2019-12-03 11:25     ` Jieun Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Snitzer @ 2019-12-02 17:39 UTC (permalink / raw)
  To: Jieun Kim; +Cc: Alasdair Kergon, dm-devel, linux-kernel, kernel-janitors

As you can see below: your patches to remove the seemingly unused sz
variables won't even compile.  The sz variable is used by the DMEMIT()
macro.

Nacked-by: Mike Snitzer <snitzer@redhat.com>

On Sun, Dec 01 2019 at  2:46am -0500,
kbuild test robot <lkp@intel.com> wrote:

> Hi Jieun,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on dm/for-next]
> [also build test ERROR on v5.4 next-20191129]
> [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/Jieun-Kim/drivers-md-dm-log-c-Remove-unused-variable-sz/20191201-134548
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
> config: i386-defconfig (attached as .config)
> compiler: gcc-7 (Debian 7.5.0-1) 7.5.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/dm-dirty-log.h:16:0,
>                     from drivers/md/dm-log.c:13:
>    drivers/md/dm-log.c: In function 'core_status':
> >> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
>     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
>                          ^
> >> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
>       DMEMIT("1 %s", log->type->name);
>       ^~~~~~
>    include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
>     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
>                          ^
> >> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
>       DMEMIT("1 %s", log->type->name);
>       ^~~~~~
> --
>    In file included from include/linux/dm-dirty-log.h:16:0,
>                     from drivers//md/dm-log.c:13:
>    drivers//md/dm-log.c: In function 'core_status':
> >> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
>     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
>                          ^
>    drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
>       DMEMIT("1 %s", log->type->name);
>       ^~~~~~
>    include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
>     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
>                          ^
>    drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
>       DMEMIT("1 %s", log->type->name);
>       ^~~~~~
> 
> vim +/DMEMIT +788 drivers/md/dm-log.c
> 
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  776  
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  777  #define	DMEMIT_SYNC \
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  778  	if (lc->sync != DEFAULTSYNC) \
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  779  		DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  780  
> 416cd17b198221 Heinz Mauelshagen  2008-04-24  781  static int core_status(struct dm_dirty_log *log, status_type_t status,
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  782  		       char *result, unsigned int maxlen)
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  783  {
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  784  	struct log_c *lc = log->context;
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  785  
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  786  	switch(status) {
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  787  	case STATUSTYPE_INFO:
> 315dcc226f066c Jonathan E Brassow 2007-05-09 @788  		DMEMIT("1 %s", log->type->name);
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  789  		break;
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  790  
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  791  	case STATUSTYPE_TABLE:
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  792  		DMEMIT("%s %u %u ", log->type->name,
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  793  		       lc->sync == DEFAULTSYNC ? 1 : 2, lc->region_size);
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  794  		DMEMIT_SYNC;
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  795  	}
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  796  
> 2a79ee10b97355 Jieun Kim          2019-12-01  797  	return 0;
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  798  }
> ^1da177e4c3f41 Linus Torvalds     2005-04-16  799  
> 
> :::::: The code at line 788 was first introduced by commit
> :::::: 315dcc226f066c1d3cef79283dcde807fe0e32d1 dm log: report fault status
> 
> :::::: TO: Jonathan E Brassow <jbrassow@redhat.com>
> :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
> 
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation



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

* Re: [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz'
  2019-12-02 17:39   ` Mike Snitzer
@ 2019-12-03 11:25     ` Jieun Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Jieun Kim @ 2019-12-03 11:25 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: Alasdair Kergon, dm-devel, linux-kernel, kernel-janitors

Thank you for your reply.
I'm sorry for the compile error. I realized that 'sz' is still used.
Next time, i will keep in mind to check out the compile result
correctly before submitting patches.

On Tue, Dec 3, 2019 at 2:39 AM Mike Snitzer <snitzer@redhat.com> wrote:
>
> As you can see below: your patches to remove the seemingly unused sz
> variables won't even compile.  The sz variable is used by the DMEMIT()
> macro.
>
> Nacked-by: Mike Snitzer <snitzer@redhat.com>
>
> On Sun, Dec 01 2019 at  2:46am -0500,
> kbuild test robot <lkp@intel.com> wrote:
>
> > Hi Jieun,
> >
> > Thank you for the patch! Yet something to improve:
> >
> > [auto build test ERROR on dm/for-next]
> > [also build test ERROR on v5.4 next-20191129]
> > [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/Jieun-Kim/drivers-md-dm-log-c-Remove-unused-variable-sz/20191201-134548
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
> > config: i386-defconfig (attached as .config)
> > compiler: gcc-7 (Debian 7.5.0-1) 7.5.0
> > reproduce:
> >         # save the attached .config to linux build tree
> >         make ARCH=i386
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> >    In file included from include/linux/dm-dirty-log.h:16:0,
> >                     from drivers/md/dm-log.c:13:
> >    drivers/md/dm-log.c: In function 'core_status':
> > >> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
> >     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
> >                          ^
> > >> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
> >       DMEMIT("1 %s", log->type->name);
> >       ^~~~~~
> >    include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
> >     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
> >                          ^
> > >> drivers/md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
> >       DMEMIT("1 %s", log->type->name);
> >       ^~~~~~
> > --
> >    In file included from include/linux/dm-dirty-log.h:16:0,
> >                     from drivers//md/dm-log.c:13:
> >    drivers//md/dm-log.c: In function 'core_status':
> > >> include/linux/device-mapper.h:551:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
> >     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
> >                          ^
> >    drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
> >       DMEMIT("1 %s", log->type->name);
> >       ^~~~~~
> >    include/linux/device-mapper.h:551:22: note: each undeclared identifier is reported only once for each function it appears in
> >     #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
> >                          ^
> >    drivers//md/dm-log.c:788:3: note: in expansion of macro 'DMEMIT'
> >       DMEMIT("1 %s", log->type->name);
> >       ^~~~~~
> >
> > vim +/DMEMIT +788 drivers/md/dm-log.c
> >
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  776
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  777  #define    DMEMIT_SYNC \
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  778     if (lc->sync != DEFAULTSYNC) \
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  779             DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  780
> > 416cd17b198221 Heinz Mauelshagen  2008-04-24  781  static int core_status(struct dm_dirty_log *log, status_type_t status,
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  782                    char *result, unsigned int maxlen)
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  783  {
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  784     struct log_c *lc = log->context;
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  785
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  786     switch(status) {
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  787     case STATUSTYPE_INFO:
> > 315dcc226f066c Jonathan E Brassow 2007-05-09 @788             DMEMIT("1 %s", log->type->name);
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  789             break;
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  790
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  791     case STATUSTYPE_TABLE:
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  792             DMEMIT("%s %u %u ", log->type->name,
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  793                    lc->sync == DEFAULTSYNC ? 1 : 2, lc->region_size);
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  794             DMEMIT_SYNC;
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  795     }
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  796
> > 2a79ee10b97355 Jieun Kim          2019-12-01  797     return 0;
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  798  }
> > ^1da177e4c3f41 Linus Torvalds     2005-04-16  799
> >
> > :::::: The code at line 788 was first introduced by commit
> > :::::: 315dcc226f066c1d3cef79283dcde807fe0e32d1 dm log: report fault status
> >
> > :::::: TO: Jonathan E Brassow <jbrassow@redhat.com>
> > :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
> >
> > ---
> > 0-DAY kernel test infrastructure                 Open Source Technology Center
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
>
>

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

end of thread, other threads:[~2019-12-03 11:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-01  5:42 [PATCH 1/2] drivers: md: dm-log.c: Remove unused variable 'sz' Jieun Kim
2019-12-01  7:46 ` kbuild test robot
2019-12-02 17:39   ` Mike Snitzer
2019-12-03 11:25     ` Jieun Kim

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