linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] dm mpath: Remove unused variable ret
@ 2020-05-07 12:26 Samuel Zou
  2020-05-07 14:29 ` Mike Snitzer
  2020-05-08  1:47 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Zou @ 2020-05-07 12:26 UTC (permalink / raw)
  To: agk, snitzer, dm-devel; +Cc: linux-kernel, Samuel Zou

This patch fixes below warning reported by coccicheck:

drivers/md/dm-historical-service-time.c:240:14-16: Unneeded variable: "sz". Return "0" on line 261

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
---
 drivers/md/dm-historical-service-time.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-historical-service-time.c b/drivers/md/dm-historical-service-time.c
index 186f91e..3c8acb9 100644
--- a/drivers/md/dm-historical-service-time.c
+++ b/drivers/md/dm-historical-service-time.c
@@ -237,7 +237,6 @@ static void hst_destroy(struct path_selector *ps)
 static int hst_status(struct path_selector *ps, struct dm_path *path,
 		     status_type_t type, char *result, unsigned int maxlen)
 {
-	unsigned int sz = 0;
 	struct path_info *pi;
 
 	if (!path) {
@@ -258,7 +257,7 @@ static int hst_status(struct path_selector *ps, struct dm_path *path,
 		}
 	}
 
-	return sz;
+	return 0;
 }
 
 static int hst_add_path(struct path_selector *ps, struct dm_path *path,
-- 
2.6.2


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

* Re: [PATCH -next] dm mpath: Remove unused variable ret
  2020-05-07 12:26 [PATCH -next] dm mpath: Remove unused variable ret Samuel Zou
@ 2020-05-07 14:29 ` Mike Snitzer
  2020-05-08  1:06   ` Samuel Zou
  2020-05-08  1:47 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Snitzer @ 2020-05-07 14:29 UTC (permalink / raw)
  To: Samuel Zou; +Cc: agk, dm-devel, linux-kernel

On Thu, May 07 2020 at  8:26am -0400,
Samuel Zou <zou_wei@huawei.com> wrote:

> This patch fixes below warning reported by coccicheck:
> 
> drivers/md/dm-historical-service-time.c:240:14-16: Unneeded variable: "sz". Return "0" on line 261
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Samuel Zou <zou_wei@huawei.com>

Nack.

DMEMIT() uses the local sz variable.


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

* Re: [PATCH -next] dm mpath: Remove unused variable ret
  2020-05-07 14:29 ` Mike Snitzer
@ 2020-05-08  1:06   ` Samuel Zou
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Zou @ 2020-05-08  1:06 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: agk, dm-devel, linux-kernel

Hi Mike,

You are right.
I did not notice that the macro DMEMIT uses the sz variable.

Thanks.

On 2020/5/7 22:29, Mike Snitzer wrote:
> On Thu, May 07 2020 at  8:26am -0400,
> Samuel Zou <zou_wei@huawei.com> wrote:
> 
>> This patch fixes below warning reported by coccicheck:
>>
>> drivers/md/dm-historical-service-time.c:240:14-16: Unneeded variable: "sz". Return "0" on line 261
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Samuel Zou <zou_wei@huawei.com>
> 
> Nack.
> 
> DMEMIT() uses the local sz variable.
> 
> 


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

* Re: [PATCH -next] dm mpath: Remove unused variable ret
  2020-05-07 12:26 [PATCH -next] dm mpath: Remove unused variable ret Samuel Zou
  2020-05-07 14:29 ` Mike Snitzer
@ 2020-05-08  1:47 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-05-08  1:47 UTC (permalink / raw)
  To: Samuel Zou, agk, snitzer, dm-devel, linux-kernel; +Cc: kbuild-all, linux-kernel

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

Hi Samuel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20200507]
[also build test ERROR on dm/for-next]
[cannot apply to v5.7-rc4]
[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/Samuel-Zou/dm-mpath-Remove-unused-variable-ret/20200508-031551
base:    6b43f715b6379433e8eb30aa9bcc99bd6a585f77
config: alpha-allyesconfig (attached as .config)
compiler: alpha-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=alpha 

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

   In file included from drivers/md/dm.h:14,
                    from drivers/md/dm-historical-service-time.c:24:
   drivers/md/dm-historical-service-time.c: In function 'hst_status':
>> include/linux/device-mapper.h:570:22: error: 'sz' undeclared (first use in this function); did you mean 's'?
     570 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
         |                      ^~
>> drivers/md/dm-historical-service-time.c:245:3: note: in expansion of macro 'DMEMIT'
     245 |   DMEMIT("2 %u %u ", s->weights[0], s->threshold_multiplier);
         |   ^~~~~~
   include/linux/device-mapper.h:570:22: note: each undeclared identifier is reported only once for each function it appears in
     570 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
         |                      ^~
>> drivers/md/dm-historical-service-time.c:245:3: note: in expansion of macro 'DMEMIT'
     245 |   DMEMIT("2 %u %u ", s->weights[0], s->threshold_multiplier);
         |   ^~~~~~

vim +/DMEMIT +245 drivers/md/dm-historical-service-time.c

580d206a4321a1 Khazhismel Kumykov 2020-04-30  236  
580d206a4321a1 Khazhismel Kumykov 2020-04-30  237  static int hst_status(struct path_selector *ps, struct dm_path *path,
580d206a4321a1 Khazhismel Kumykov 2020-04-30  238  		     status_type_t type, char *result, unsigned int maxlen)
580d206a4321a1 Khazhismel Kumykov 2020-04-30  239  {
580d206a4321a1 Khazhismel Kumykov 2020-04-30  240  	struct path_info *pi;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  241  
580d206a4321a1 Khazhismel Kumykov 2020-04-30  242  	if (!path) {
580d206a4321a1 Khazhismel Kumykov 2020-04-30  243  		struct selector *s = ps->context;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  244  
580d206a4321a1 Khazhismel Kumykov 2020-04-30 @245  		DMEMIT("2 %u %u ", s->weights[0], s->threshold_multiplier);
580d206a4321a1 Khazhismel Kumykov 2020-04-30  246  	} else {
580d206a4321a1 Khazhismel Kumykov 2020-04-30  247  		pi = path->pscontext;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  248  
580d206a4321a1 Khazhismel Kumykov 2020-04-30  249  		switch (type) {
580d206a4321a1 Khazhismel Kumykov 2020-04-30  250  		case STATUSTYPE_INFO:
580d206a4321a1 Khazhismel Kumykov 2020-04-30  251  			DMEMIT("%llu %llu %llu ", pi->historical_service_time,
580d206a4321a1 Khazhismel Kumykov 2020-04-30  252  			       pi->outstanding, pi->stale_after);
580d206a4321a1 Khazhismel Kumykov 2020-04-30  253  			break;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  254  		case STATUSTYPE_TABLE:
580d206a4321a1 Khazhismel Kumykov 2020-04-30  255  			DMEMIT("0 ");
580d206a4321a1 Khazhismel Kumykov 2020-04-30  256  			break;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  257  		}
580d206a4321a1 Khazhismel Kumykov 2020-04-30  258  	}
580d206a4321a1 Khazhismel Kumykov 2020-04-30  259  
356072d04813ba Samuel Zou         2020-05-07  260  	return 0;
580d206a4321a1 Khazhismel Kumykov 2020-04-30  261  }
580d206a4321a1 Khazhismel Kumykov 2020-04-30  262  

:::::: The code at line 245 was first introduced by commit
:::::: 580d206a4321a146ef4637f14f2fc6d0d5c72c12 dm mpath: add Historical Service Time Path Selector

:::::: TO: Khazhismel Kumykov <khazhy@google.com>
:::::: CC: Mike Snitzer <snitzer@redhat.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: 61824 bytes --]

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

end of thread, other threads:[~2020-05-08  1:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 12:26 [PATCH -next] dm mpath: Remove unused variable ret Samuel Zou
2020-05-07 14:29 ` Mike Snitzer
2020-05-08  1:06   ` Samuel Zou
2020-05-08  1:47 ` 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).