lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 11 Apr 2021 14:56:35 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc:     Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>, jikos@...nel.org,
        benjamin.tissoires@...hat.com, linux-input@...r.kernel.org,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] HID: hid-sensor-custom: remove useless variable

On Fri, 09 Apr 2021 11:19:12 -0700
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com> wrote:

> On Fri, 2021-04-09 at 15:15 +0800, Jiapeng Chong wrote:
> > Fix the following gcc warning:
> > 
> > drivers/hid/hid-sensor-custom.c:400:7: warning: variable ‘ret’ set
> > but
> > not used [-Wunused-but-set-variable].
> > 
> > Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>  
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com

Perhaps better to return ret if it is non zero?
I can't immediately figure out if there is a reason we know that can't
happen.

Jonathan

> 
> > ---
> >  drivers/hid/hid-sensor-custom.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-
> > sensor-custom.c
> > index 2628bc5..e430673 100644
> > --- a/drivers/hid/hid-sensor-custom.c
> > +++ b/drivers/hid/hid-sensor-custom.c
> > @@ -397,15 +397,14 @@ static ssize_t store_value(struct device *dev,
> > struct device_attribute *attr,
> >  
> >  	if (!strncmp(name, "value", strlen("value"))) {
> >  		u32 report_id;
> > -		int ret;
> >  
> >  		if (kstrtoint(buf, 0, &value) != 0)
> >  			return -EINVAL;
> >  
> >  		report_id = sensor_inst->fields[field_index].attribute.
> >  								report_
> > id;
> > -		ret = sensor_hub_set_feature(sensor_inst->hsdev,
> > report_id,
> > -					     index, sizeof(value),
> > &value);
> > +		sensor_hub_set_feature(sensor_inst->hsdev, report_id,
> > index,
> > +				       sizeof(value), &value);
> >  	} else
> >  		return -EINVAL;
> >    
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ