linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
	jikos@kernel.org, benjamin.tissoires@redhat.com,
	linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: hid-sensor-custom: remove useless variable
Date: Sun, 11 Apr 2021 14:56:35 +0100	[thread overview]
Message-ID: <20210411145635.3c6b48d1@jic23-huawei> (raw)
In-Reply-To: <4079bb49a9c0022603abeffcdaec32208f449e51.camel@linux.intel.com>

On Fri, 09 Apr 2021 11:19:12 -0700
Srinivas Pandruvada <srinivas.pandruvada@linux.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@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>  
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.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;
> >    
> 


  reply	other threads:[~2021-04-11 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  7:15 [PATCH] HID: hid-sensor-custom: remove useless variable Jiapeng Chong
2021-04-09 18:19 ` Srinivas Pandruvada
2021-04-11 13:56   ` Jonathan Cameron [this message]
2021-04-11 16:06     ` Srinivas Pandruvada
2021-04-12 10:20       ` Jonathan Cameron
2021-04-12 22:27         ` srinivas pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210411145635.3c6b48d1@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).