diff mbox series

[v2,2/3] staging: iio: ad7150: simplify i2c SMBus return treatment

Message ID 90e8a25eca0825878d55fe0a9e760906b4689035.1560529045.git.melissa.srw@gmail.com (mailing list archive)
State New, archived
Headers show
Series staging: iio: ad7150: improve driver readability | expand

Commit Message

Melissa Wen June 14, 2019, 4:32 p.m. UTC
Since i2c_smbus_write_byte_data returns no-positive value, this commit
making the treatment of its return value less verbose.

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
---
 drivers/staging/iio/cdc/ad7150.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Jonathan Cameron June 16, 2019, 10:20 a.m. UTC | #1
On Fri, 14 Jun 2019 13:32:54 -0300
Melissa Wen <melissa.srw@gmail.com> wrote:

> Since i2c_smbus_write_byte_data returns no-positive value, this commit
> making the treatment of its return value less verbose.
> 
> Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/staging/iio/cdc/ad7150.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 091aa33589d7..7d56f10a19ed 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -202,16 +202,11 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
>  	ret = i2c_smbus_write_byte_data(chip->client,
>  					ad7150_addresses[chan][4],
>  					sens);
> -	if (ret < 0)
> +	if (ret)
>  		return ret;
> -
> -	ret = i2c_smbus_write_byte_data(chip->client,
> +	return i2c_smbus_write_byte_data(chip->client,
>  					ad7150_addresses[chan][5],
>  					timeout);
> -	if (ret < 0)
> -		return ret;
> -
> -	return 0;
>  }
>  
>  static int ad7150_write_event_config(struct iio_dev *indio_dev,
diff mbox series

Patch

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 091aa33589d7..7d56f10a19ed 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -202,16 +202,11 @@  static int ad7150_write_event_params(struct iio_dev *indio_dev,
 	ret = i2c_smbus_write_byte_data(chip->client,
 					ad7150_addresses[chan][4],
 					sens);
-	if (ret < 0)
+	if (ret)
 		return ret;
-
-	ret = i2c_smbus_write_byte_data(chip->client,
+	return i2c_smbus_write_byte_data(chip->client,
 					ad7150_addresses[chan][5],
 					timeout);
-	if (ret < 0)
-		return ret;
-
-	return 0;
 }
 
 static int ad7150_write_event_config(struct iio_dev *indio_dev,