Re: [PATCH 4/7] iio:light:cm3323: drop barely used variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17/06/15 11:09, Daniel Baluta wrote:
> On Wed, Jun 17, 2015 at 1:17 AM, Hartmut Knaack <knaack.h@xxxxxx> wrote:
>> In cm3323_disable() ret is just used to check for errors during I2C write.
>> Consolidate the write and the check to save a variable and two lines of
>> code.
>>
>> Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
> 
> I don't really like this. It makes code harder to read.
> 
> Other opinions?
> 
I'm going to side with Daniel on this one...  Lets leave it as is.

Jonathan
>> ---
>>  drivers/iio/light/cm3323.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c
>> index f88a0ed..8945e0c 100644
>> --- a/drivers/iio/light/cm3323.c
>> +++ b/drivers/iio/light/cm3323.c
>> @@ -106,12 +106,10 @@ static int cm3323_init(struct iio_dev *indio_dev)
>>
>>  static void cm3323_disable(struct iio_dev *indio_dev)
>>  {
>> -       int ret;
>>         struct cm3323_data *data = iio_priv(indio_dev);
>>
>> -       ret = i2c_smbus_write_word_data(data->client, CM3323_CMD_CONF,
>> -                                       CM3323_CONF_SD_BIT);
>> -       if (ret < 0)
>> +       if (i2c_smbus_write_word_data(data->client, CM3323_CMD_CONF,
>> +                                     CM3323_CONF_SD_BIT) < 0)
>>                 dev_err(&data->client->dev, "Error writing reg_conf\n");
>>  }
>>
>> --

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux