[hid:for-5.12/playstation 3/13] drivers/hid/hid-playstation.c:170:6: warning: variable 'ret' set but not used

From: kernel test robot <hidden>
Date: 2021-02-11 22:11:25
Also in: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-5.12/playstation
head:   1f902f8636e499c32f0b55e1ce150082829ef033
commit: d30bca44809eb1d2937e59d3d09694f40613070d [3/13] HID: playstation: add DualSense battery support.
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?id=d30bca44809eb1d2937e59d3d09694f40613070d
        git remote add hid https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
        git fetch --no-tags hid for-5.12/playstation
        git checkout d30bca44809eb1d2937e59d3d09694f40613070d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All warnings (new ones prefixed by >>):

   drivers/hid/hid-playstation.c: In function 'ps_battery_get_property':
quoted
drivers/hid/hid-playstation.c:170:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     170 |  int ret;
         |      ^~~


vim +/ret +170 drivers/hid/hid-playstation.c

   161	
   162	static int ps_battery_get_property(struct power_supply *psy,
   163			enum power_supply_property psp,
   164			union power_supply_propval *val)
   165	{
   166		struct ps_device *dev = power_supply_get_drvdata(psy);
   167		uint8_t battery_capacity;
   168		int battery_status;
   169		unsigned long flags;
 > 170		int ret;
   171	
   172		spin_lock_irqsave(&dev->lock, flags);
   173		battery_capacity = dev->battery_capacity;
   174		battery_status = dev->battery_status;
   175		spin_unlock_irqrestore(&dev->lock, flags);
   176	
   177		switch (psp) {
   178		case POWER_SUPPLY_PROP_STATUS:
   179			val->intval = battery_status;
   180			break;
   181		case POWER_SUPPLY_PROP_PRESENT:
   182			val->intval = 1;
   183			break;
   184		case POWER_SUPPLY_PROP_CAPACITY:
   185			val->intval = battery_capacity;
   186			break;
   187		case POWER_SUPPLY_PROP_SCOPE:
   188			val->intval = POWER_SUPPLY_SCOPE_DEVICE;
   189			break;
   190		default:
   191			ret = -EINVAL;
   192			break;
   193		}
   194	
   195		return 0;
   196	}
   197	

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help