public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Hartmut Knaack <knaack.h@gmx.de>
To: Daniel Baluta <daniel.baluta@intel.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Kevin Tsai <ktsai@capellamicro.com>
Subject: Re: [PATCH 5/7] iio:light:cm3323: replace unneeded variable
Date: Thu, 18 Jun 2015 00:28:05 +0200	[thread overview]
Message-ID: <5581F475.50202@gmx.de> (raw)
In-Reply-To: <CAEnQRZC2ypA8tVFg61Sic5RiqXyiNhTYhGYds0JskPRcEy=_hA@mail.gmail.com>

Daniel Baluta schrieb am 17.06.2015 um 12:14:
> On Wed, Jun 17, 2015 at 1:17 AM, Hartmut Knaack <knaack.h@gmx.de> wrote:
>> In cm3323_read_raw() i is used as return variable for the integration time
>> index. The also existing return variable ret however is unused in this
>> case, although appropriate. Replace i with ret and drop it.
>>
>> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
> 
> Fair enough.
> 
> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
> 
> Are you using a tool for finding such situations? Or just code reading ? :)

Plain code reading FTW ;-) Working through a checklist and questioning every
piece of code for its benefit.

> 
>> ---
>>  drivers/iio/light/cm3323.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c
>> index 8945e0c..6bb75e7 100644
>> --- a/drivers/iio/light/cm3323.c
>> +++ b/drivers/iio/light/cm3323.c
>> @@ -153,7 +153,7 @@ static int cm3323_read_raw(struct iio_dev *indio_dev,
>>                            struct iio_chan_spec const *chan, int *val,
>>                            int *val2, long mask)
>>  {
>> -       int i, ret;
>> +       int ret;
>>         struct cm3323_data *data = iio_priv(indio_dev);
>>
>>         switch (mask) {
>> @@ -170,14 +170,14 @@ static int cm3323_read_raw(struct iio_dev *indio_dev,
>>                 return IIO_VAL_INT;
>>         case IIO_CHAN_INFO_INT_TIME:
>>                 mutex_lock(&data->mutex);
>> -               i = cm3323_get_it_bits(data);
>> -               if (i < 0) {
>> +               ret = cm3323_get_it_bits(data);
>> +               if (ret < 0) {
>>                         mutex_unlock(&data->mutex);
>> -                       return i;
>> +                       return ret;
>>                 }
>>
>> -               *val = cm3323_int_time[i].val;
>> -               *val2 = cm3323_int_time[i].val2;
>> +               *val = cm3323_int_time[ret].val;
>> +               *val2 = cm3323_int_time[ret].val2;
>>                 mutex_unlock(&data->mutex);
>>
>>                 return IIO_VAL_INT_PLUS_MICRO;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2015-06-17 22:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 22:16 [PATCH 0/7] cm3323 fixes and cleanups Hartmut Knaack
2015-06-16 22:17 ` [PATCH 1/7] iio:light:cm3323: clear bitmask before set Hartmut Knaack
2015-06-17  7:14   ` Hartmut Knaack
2015-06-16 22:17 ` [PATCH 2/7] iio:light:Kconfig: fix typo in description Hartmut Knaack
2015-06-17 10:05   ` Daniel Baluta
2015-06-16 22:17 ` [PATCH 3/7] iio:light:cm3323: pass up error value Hartmut Knaack
2015-06-17 10:06   ` Daniel Baluta
2015-06-16 22:17 ` [PATCH 4/7] iio:light:cm3323: drop barely used variable Hartmut Knaack
2015-06-17 10:09   ` Daniel Baluta
2015-06-21 13:21     ` Jonathan Cameron
2015-06-16 22:17 ` [PATCH 5/7] iio:light:cm3323: replace unneeded variable Hartmut Knaack
2015-06-17 10:14   ` Daniel Baluta
2015-06-17 22:28     ` Hartmut Knaack [this message]
2015-06-16 22:17 ` [PATCH 6/7] iio:light:cm3323: make use of GENMASK Hartmut Knaack
2015-06-16 22:29   ` Peter Meerwald
2015-06-17  7:13     ` Hartmut Knaack
2015-06-16 22:17 ` [PATCH 7/7] iio:light:cm3323: add empty lines for code structure Hartmut Knaack
2015-06-17 10:17   ` Daniel Baluta

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=5581F475.50202@gmx.de \
    --to=knaack.h@gmx.de \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=ktsai@capellamicro.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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