Message ID | 1615282320-28246-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive) |
---|---|
State | Rejected, archived |
Delegated to: | Mike Snitzer |
Headers | show |
Series | dm: remove unneeded variable 'sz' | expand |
Hi Yang, Thank you for the patch! Yet something to improve: [auto build test ERROR on dm/for-next] [also build test ERROR on v5.12-rc2 next-20210309] [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/dm-remove-unneeded-variable-sz/20210309-173431 base: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next config: x86_64-randconfig-a011-20210308 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 820f508b08d7c94b2dd7847e9710d2bc36d3dd45) 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 x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/a0feb390ae71f527ea5582a23afa1889bba31eab git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Li/dm-remove-unneeded-variable-sz/20210309-173431 git checkout a0feb390ae71f527ea5582a23afa1889bba31eab # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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 >>): >> drivers/md/dm-ps-service-time.c:88:3: error: use of undeclared identifier 'sz' DMEMIT("0 "); ^ include/linux/device-mapper.h:588:22: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ >> drivers/md/dm-ps-service-time.c:88:3: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:588:30: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ >> drivers/md/dm-ps-service-time.c:88:3: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:29: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ >> drivers/md/dm-ps-service-time.c:88:3: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:42: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ drivers/md/dm-ps-service-time.c:94:4: error: use of undeclared identifier 'sz' DMEMIT("%d %u ", atomic_read(&pi->in_flight_size), ^ include/linux/device-mapper.h:588:22: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ drivers/md/dm-ps-service-time.c:94:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:588:30: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ drivers/md/dm-ps-service-time.c:94:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:29: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ drivers/md/dm-ps-service-time.c:94:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:42: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ drivers/md/dm-ps-service-time.c:98:4: error: use of undeclared identifier 'sz' DMEMIT("%u %u ", pi->repeat_count, ^ include/linux/device-mapper.h:588:22: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ drivers/md/dm-ps-service-time.c:98:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:588:30: note: expanded from macro 'DMEMIT' #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ ^ drivers/md/dm-ps-service-time.c:98:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:29: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ drivers/md/dm-ps-service-time.c:98:4: error: use of undeclared identifier 'sz' include/linux/device-mapper.h:589:42: note: expanded from macro 'DMEMIT' 0 : scnprintf(result + sz, maxlen - sz, x)) ^ 12 errors generated. vim +/sz +88 drivers/md/dm-ps-service-time.c f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 81 f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 82 static int st_status(struct path_selector *ps, struct dm_path *path, f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 83 status_type_t type, char *result, unsigned maxlen) f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 84 { f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 85 struct path_info *pi; f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 86 f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 87 if (!path) f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 @88 DMEMIT("0 "); f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 89 else { f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 90 pi = path->pscontext; f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 91 f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 92 switch (type) { f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 93 case STATUSTYPE_INFO: f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 94 DMEMIT("%d %u ", atomic_read(&pi->in_flight_size), f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 95 pi->relative_throughput); f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 96 break; f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 97 case STATUSTYPE_TABLE: f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 98 DMEMIT("%u %u ", pi->repeat_count, f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 99 pi->relative_throughput); f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 100 break; f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 101 } f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 102 } f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 103 a0feb390ae71f5 drivers/md/dm-ps-service-time.c Yang Li 2021-03-09 104 return 0; f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 105 } f392ba889b0196 drivers/md/dm-service-time.c Kiyoshi Ueda 2009-06-22 106 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
Hi Yang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on dm/for-next]
[also build test ERROR on v5.12-rc2 next-20210309]
[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/dm-remove-unneeded-variable-sz/20210309-173431
base: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: x86_64-rhel-7.6-kselftests (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/a0feb390ae71f527ea5582a23afa1889bba31eab
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/dm-remove-unneeded-variable-sz/20210309-173431
git checkout a0feb390ae71f527ea5582a23afa1889bba31eab
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
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.h:14,
from drivers/md/dm-ps-service-time.c:11:
drivers/md/dm-ps-service-time.c: In function 'st_status':
>> include/linux/device-mapper.h:588:22: error: 'sz' undeclared (first use in this function); did you mean 's8'?
588 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
| ^~
drivers/md/dm-ps-service-time.c:88:3: note: in expansion of macro 'DMEMIT'
88 | DMEMIT("0 ");
| ^~~~~~
include/linux/device-mapper.h:588:22: note: each undeclared identifier is reported only once for each function it appears in
588 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
| ^~
drivers/md/dm-ps-service-time.c:88:3: note: in expansion of macro 'DMEMIT'
88 | DMEMIT("0 ");
| ^~~~~~
vim +588 include/linux/device-mapper.h
0da336e5fab75c Alasdair G Kergon 2008-04-24 587
0da336e5fab75c Alasdair G Kergon 2008-04-24 @588 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
0da336e5fab75c Alasdair G Kergon 2008-04-24 589 0 : scnprintf(result + sz, maxlen - sz, x))
0da336e5fab75c Alasdair G Kergon 2008-04-24 590
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
On Tue, Mar 09 2021 at 4:32am -0500, Yang Li <yang.lee@linux.alibaba.com> wrote: > Fix the following coccicheck warning: > ./drivers/md/dm-ps-service-time.c:85:10-12: Unneeded variable: "sz". > Return "0" on line 105 > > Reported-by: Abaci Robot <abaci@linux.alibaba.com> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> This type of change gets proposed regaularly. Would appreciate it if you could fix coccicheck to not get this wrong. The local 'sz' variable is used by the DMEMIT macro (as the earlier reply to this email informed you). Also, had you tried to compile the code with your patch applied you'd have quickly realized your patch wasn't correct. Mike > --- > drivers/md/dm-ps-service-time.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/md/dm-ps-service-time.c b/drivers/md/dm-ps-service-time.c > index 9cfda66..12dd5ce 100644 > --- a/drivers/md/dm-ps-service-time.c > +++ b/drivers/md/dm-ps-service-time.c > @@ -82,7 +82,6 @@ static void st_destroy(struct path_selector *ps) > static int st_status(struct path_selector *ps, struct dm_path *path, > status_type_t type, char *result, unsigned maxlen) > { > - unsigned sz = 0; > struct path_info *pi; > > if (!path) > @@ -102,7 +101,7 @@ static int st_status(struct path_selector *ps, struct dm_path *path, > } > } > > - return sz; > + return 0; > } > > static int st_add_path(struct path_selector *ps, struct dm_path *path, > -- > 1.8.3.1 > -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
diff --git a/drivers/md/dm-ps-service-time.c b/drivers/md/dm-ps-service-time.c index 9cfda66..12dd5ce 100644 --- a/drivers/md/dm-ps-service-time.c +++ b/drivers/md/dm-ps-service-time.c @@ -82,7 +82,6 @@ static void st_destroy(struct path_selector *ps) static int st_status(struct path_selector *ps, struct dm_path *path, status_type_t type, char *result, unsigned maxlen) { - unsigned sz = 0; struct path_info *pi; if (!path) @@ -102,7 +101,7 @@ static int st_status(struct path_selector *ps, struct dm_path *path, } } - return sz; + return 0; } static int st_add_path(struct path_selector *ps, struct dm_path *path,
Fix the following coccicheck warning: ./drivers/md/dm-ps-service-time.c:85:10-12: Unneeded variable: "sz". Return "0" on line 105 Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> --- drivers/md/dm-ps-service-time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)