Daniel Baluta schrieb am 17.06.2015 um 12:14: > On Wed, Jun 17, 2015 at 1:17 AM, Hartmut Knaack <knaack.h@xxxxxx> 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@xxxxxx> > > Fair enough. > > Reviewed-by: Daniel Baluta <daniel.baluta@xxxxxxxxx> > > 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@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html