diff mbox series

[4/5] iio:potentiostat:lmp91000: invert if statement

Message ID 20190218172236.7781-5-lucasseikioshiro@gmail.com (mailing list archive)
State New, archived
Headers show
Series iio:potentiostat:lmp91000: Adjust codestyle, and minor cleanup changes | expand

Commit Message

Lucas Seiki Oshiro Feb. 18, 2019, 5:22 p.m. UTC
Invert if statement arms in line 214, in order to make the code cleaner

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
---
 drivers/iio/potentiostat/lmp91000.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron Feb. 20, 2019, 9:52 a.m. UTC | #1
On Mon, 18 Feb 2019 14:22:35 -0300
Lucas Oshiro <lucasseikioshiro@gmail.com> wrote:

> Invert if statement arms in line 214, in order to make the code cleaner
> 
> Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
> Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>

Given this undoes one of the earlier changes, please merge them.

Jonathan

> ---
>  drivers/iio/potentiostat/lmp91000.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
> index 6dba26121a62..7229ef59590a 100644
> --- a/drivers/iio/potentiostat/lmp91000.c
> +++ b/drivers/iio/potentiostat/lmp91000.c
> @@ -211,12 +211,11 @@ static int lmp91000_read_config(struct lmp91000_data *data)
>  
>  	ret = of_property_read_u32(np, "ti,tia-gain-ohm", &val);
>  	if (ret) {
> -		if (of_property_read_bool(np, "ti,external-tia-resistor")) {
> -			val = 0;
> -		} else {
> +		if (!of_property_read_bool(np, "ti,external-tia-resistor")) {
>  			dev_err(dev, "no ti,tia-gain-ohm defined");
>  			return ret;
>  		}
> +		val = 0;
>  	}
>  
>  	ret = -EINVAL;
diff mbox series

Patch

diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
index 6dba26121a62..7229ef59590a 100644
--- a/drivers/iio/potentiostat/lmp91000.c
+++ b/drivers/iio/potentiostat/lmp91000.c
@@ -211,12 +211,11 @@  static int lmp91000_read_config(struct lmp91000_data *data)
 
 	ret = of_property_read_u32(np, "ti,tia-gain-ohm", &val);
 	if (ret) {
-		if (of_property_read_bool(np, "ti,external-tia-resistor")) {
-			val = 0;
-		} else {
+		if (!of_property_read_bool(np, "ti,external-tia-resistor")) {
 			dev_err(dev, "no ti,tia-gain-ohm defined");
 			return ret;
 		}
+		val = 0;
 	}
 
 	ret = -EINVAL;