2022-08-27 16:44:11

by Shaomin Deng

[permalink] [raw]
Subject: [PATCH] dm: Remove the unneeeded variable

The variable "sz" is unneeded, return 0 will be okay.

Signed-off-by: Shaomin Deng <[email protected]>
---
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 0c6620e7b7bf..a4955eb96d6f 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -805,7 +805,6 @@ static int core_status(struct dm_dirty_log *log, status_type_t status,
static int disk_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) {
@@ -828,7 +827,7 @@ static int disk_status(struct dm_dirty_log *log, status_type_t status,
break;
}

- return sz;
+ return 0;
}

static struct dm_dirty_log_type _core_type = {
--
2.35.1


2022-08-27 18:47:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] dm: Remove the unneeeded variable

Hi Shaomin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v6.0-rc2]
[also build test ERROR on linus/master next-20220826]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Shaomin-Deng/dm-Remove-the-unneeeded-variable/20220828-004044
base: 1c23f9e627a7b412978b4e852793c5e3c3efc555
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220828/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/fd20974ffc753b102401c766eb62117c276a1527
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shaomin-Deng/dm-Remove-the-unneeeded-variable/20220828-004044
git checkout fd20974ffc753b102401c766eb62117c276a1527
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

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


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

0da336e5fab75c Alasdair G Kergon 2008-04-24 614
0da336e5fab75c Alasdair G Kergon 2008-04-24 @615 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
0da336e5fab75c Alasdair G Kergon 2008-04-24 616 0 : scnprintf(result + sz, maxlen - sz, x))
0da336e5fab75c Alasdair G Kergon 2008-04-24 617

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-27 20:56:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] dm: Remove the unneeeded variable

Hi Shaomin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v6.0-rc2]
[also build test ERROR on linus/master next-20220826]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Shaomin-Deng/dm-Remove-the-unneeeded-variable/20220828-004044
base: 1c23f9e627a7b412978b4e852793c5e3c3efc555
config: riscv-randconfig-r003-20220828 (https://download.01.org/0day-ci/archive/20220828/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project a2100daf12fb980a29fd1a9c85ccf8eaaaf79730)
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/intel-lab-lkp/linux/commit/fd20974ffc753b102401c766eb62117c276a1527
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shaomin-Deng/dm-Remove-the-unneeeded-variable/20220828-004044
git checkout fd20974ffc753b102401c766eb62117c276a1527
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/md/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/md/dm-log.c:810:3: error: use of undeclared identifier 'sz'
DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
^
include/linux/device-mapper.h:615:22: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
>> drivers/md/dm-log.c:810:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:615:30: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
>> drivers/md/dm-log.c:810:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:616:29: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
>> drivers/md/dm-log.c:810:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:616:42: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
drivers/md/dm-log.c:817:3: error: use of undeclared identifier 'sz'
DMEMIT("%s %u %s %u ", log->type->name,
^
include/linux/device-mapper.h:615:22: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
drivers/md/dm-log.c:817:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:615:30: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
drivers/md/dm-log.c:817:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:616:29: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
drivers/md/dm-log.c:817:3: error: use of undeclared identifier 'sz'
include/linux/device-mapper.h:616:42: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
drivers/md/dm-log.c:820:3: error: use of undeclared identifier 'sz'
DMEMIT_SYNC;
^
drivers/md/dm-log.c:776:3: note: expanded from macro 'DMEMIT_SYNC'
DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
^
include/linux/device-mapper.h:615:22: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
drivers/md/dm-log.c:820:3: error: use of undeclared identifier 'sz'
drivers/md/dm-log.c:776:3: note: expanded from macro 'DMEMIT_SYNC'
DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
^
include/linux/device-mapper.h:615:30: note: expanded from macro 'DMEMIT'
#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
^
drivers/md/dm-log.c:820:3: error: use of undeclared identifier 'sz'
drivers/md/dm-log.c:776:3: note: expanded from macro 'DMEMIT_SYNC'
DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
^
include/linux/device-mapper.h:616:29: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
drivers/md/dm-log.c:820:3: error: use of undeclared identifier 'sz'
drivers/md/dm-log.c:776:3: note: expanded from macro 'DMEMIT_SYNC'
DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
^
include/linux/device-mapper.h:616:42: note: expanded from macro 'DMEMIT'
0 : scnprintf(result + sz, maxlen - sz, x))
^
12 errors generated.


vim +/sz +810 drivers/md/dm-log.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 802
416cd17b198221 Heinz Mauelshagen 2008-04-24 803 static int disk_status(struct dm_dirty_log *log, status_type_t status,
^1da177e4c3f41 Linus Torvalds 2005-04-16 804 char *result, unsigned int maxlen)
^1da177e4c3f41 Linus Torvalds 2005-04-16 805 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 806 struct log_c *lc = log->context;
^1da177e4c3f41 Linus Torvalds 2005-04-16 807
^1da177e4c3f41 Linus Torvalds 2005-04-16 808 switch(status) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 809 case STATUSTYPE_INFO:
315dcc226f066c Jonathan E Brassow 2007-05-09 @810 DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
64b30c46e866bb Mikulas Patocka 2009-12-10 811 lc->log_dev_flush_failed ? 'F' :
64b30c46e866bb Mikulas Patocka 2009-12-10 812 lc->log_dev_failed ? 'D' :
64b30c46e866bb Mikulas Patocka 2009-12-10 813 'A');
^1da177e4c3f41 Linus Torvalds 2005-04-16 814 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 815
^1da177e4c3f41 Linus Torvalds 2005-04-16 816 case STATUSTYPE_TABLE:
^1da177e4c3f41 Linus Torvalds 2005-04-16 817 DMEMIT("%s %u %s %u ", log->type->name,
315dcc226f066c Jonathan E Brassow 2007-05-09 818 lc->sync == DEFAULTSYNC ? 2 : 3, lc->log_dev->name,
^1da177e4c3f41 Linus Torvalds 2005-04-16 819 lc->region_size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 820 DMEMIT_SYNC;
8ec456629d0bf0 Tushar Sugandhi 2021-07-12 821 break;
8ec456629d0bf0 Tushar Sugandhi 2021-07-12 822
8ec456629d0bf0 Tushar Sugandhi 2021-07-12 823 case STATUSTYPE_IMA:
8ec456629d0bf0 Tushar Sugandhi 2021-07-12 824 *result = '\0';
8ec456629d0bf0 Tushar Sugandhi 2021-07-12 825 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 826 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 827
fd20974ffc753b Shaomin Deng 2022-08-27 828 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 829 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 830

--
0-DAY CI Kernel Test Service
https://01.org/lkp