diff mbox series

Input: i8042: Remove unneeded variable

Message ID 20210225092943.657-1-angkery@163.com
State New
Headers show
Series Input: i8042: Remove unneeded variable | expand

Commit Message

Junlin Yang Feb. 25, 2021, 9:29 a.m. UTC
From: Junlin Yang <yangjunlin@yulong.com>

The variable "delay" is initialized to zero and then returned.
So remove the delay variable and return zero.

Generated by:scripts/coccinelle/misc/returnvar.cocci

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
 drivers/input/serio/i8042.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

kernel test robot Feb. 25, 2021, 3:30 p.m. UTC | #1
Hi angkery,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on v5.11 next-20210225]
[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/angkery/Input-i8042-Remove-unneeded-variable/20210225-215352
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-r031-20210225 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/d3f5af97cbc5d1ff5f8a3e96e4d858335f910e78
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review angkery/Input-i8042-Remove-unneeded-variable/20210225-215352
        git checkout d3f5af97cbc5d1ff5f8a3e96e4d858335f910e78
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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/input/serio/i8042.h:23,
                    from drivers/input/serio/i8042.c:131:
   drivers/input/serio/i8042-x86ia64io.h:591:14: warning: initialized field overwritten [-Woverride-init]
     591 |   .matches = {
         |              ^
   drivers/input/serio/i8042-x86ia64io.h:591:14: note: (near initialization for 'i8042_dmi_noselftest_table[0].matches')
   drivers/input/serio/i8042.c: In function 'i8042_panic_blink':
>> drivers/input/serio/i8042.c:1125:37: error: 'delay' undeclared (first use in this function); did you mean 'mdelay'?
    1125 | #define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0)
         |                                     ^~~~~
   drivers/input/serio/i8042.c:1133:3: note: in expansion of macro 'DELAY'
    1133 |   DELAY;
         |   ^~~~~
   drivers/input/serio/i8042.c:1125:37: note: each undeclared identifier is reported only once for each function it appears in
    1125 | #define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0)
         |                                     ^~~~~
   drivers/input/serio/i8042.c:1133:3: note: in expansion of macro 'DELAY'
    1133 |   DELAY;
         |   ^~~~~


vim +1125 drivers/input/serio/i8042.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  1113  
^1da177e4c3f41 Linus Torvalds     2005-04-16  1114  
^1da177e4c3f41 Linus Torvalds     2005-04-16  1115  /*
c7ff0d9c92435e TAMUKI Shoichi     2010-08-10  1116   * i8042_panic_blink() will turn the keyboard LEDs on or off and is called
c7ff0d9c92435e TAMUKI Shoichi     2010-08-10  1117   * when kernel panics. Flashing LEDs is useful for users running X who may
aa5e5dc2a8878e Michael Opdenacker 2013-09-18  1118   * not see the console and will help distinguishing panics from "real"
^1da177e4c3f41 Linus Torvalds     2005-04-16  1119   * lockups.
^1da177e4c3f41 Linus Torvalds     2005-04-16  1120   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  1121   * Note that DELAY has a limit of 10ms so we will not get stuck here
^1da177e4c3f41 Linus Torvalds     2005-04-16  1122   * waiting for KBC to free up even if KBD interrupt is off
^1da177e4c3f41 Linus Torvalds     2005-04-16  1123   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  1124  
^1da177e4c3f41 Linus Torvalds     2005-04-16 @1125  #define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0)
^1da177e4c3f41 Linus Torvalds     2005-04-16  1126  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index abae23a..145bda1 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1126,7 +1126,6 @@  static void i8042_controller_reset(bool s2r_wants_reset)
 
 static long i8042_panic_blink(int state)
 {
-	long delay = 0;
 	char led;
 
 	led = (state) ? 0x01 | 0x04 : 0;
@@ -1142,7 +1141,7 @@  static long i8042_panic_blink(int state)
 	dbg("%02x -> i8042 (panic blink)\n", led);
 	i8042_write_data(led);
 	DELAY;
-	return delay;
+	return 0;
 }
 
 #undef DELAY