* [PATCH v2] staging: iio: meter: replace ternary operator by if condition
@ 2022-11-13 5:28 Deepak R Varma
2022-11-13 13:03 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Deepak R Varma @ 2022-11-13 5:28 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman, linux-iio, linux-staging, linux-kernel
Replace ternary operator by simple if based evaluation of the return
value. Issue identified using coccicheck.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Changes in v2:
1. Use if based evaluation instead of using min macro
suggested by Joe Perches.
drivers/staging/iio/meter/ade7854-i2c.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
index a9a06e8dda51..71b67dd3c8e9 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -61,7 +61,10 @@ static int ade7854_i2c_write_reg(struct device *dev,
unlock:
mutex_unlock(&st->buf_lock);
- return ret < 0 ? ret : 0;
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
static int ade7854_i2c_read_reg(struct device *dev,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] staging: iio: meter: replace ternary operator by if condition
2022-11-13 5:28 [PATCH v2] staging: iio: meter: replace ternary operator by if condition Deepak R Varma
@ 2022-11-13 13:03 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-11-13 13:03 UTC (permalink / raw)
To: Deepak R Varma
Cc: Lars-Peter Clausen, Michael Hennerich, Greg Kroah-Hartman,
linux-iio, linux-staging, linux-kernel
On Sun, 13 Nov 2022 10:58:20 +0530
Deepak R Varma <drv@mailo.com> wrote:
> Replace ternary operator by simple if based evaluation of the return
> value. Issue identified using coccicheck.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
Applied to the togreg branch of iio.git and pushed out as testing to
see if 0-day can find anything we missed.
Thanks,
Jonathan
> ---
>
> Changes in v2:
> 1. Use if based evaluation instead of using min macro
> suggested by Joe Perches.
>
>
> drivers/staging/iio/meter/ade7854-i2c.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
> index a9a06e8dda51..71b67dd3c8e9 100644
> --- a/drivers/staging/iio/meter/ade7854-i2c.c
> +++ b/drivers/staging/iio/meter/ade7854-i2c.c
> @@ -61,7 +61,10 @@ static int ade7854_i2c_write_reg(struct device *dev,
> unlock:
> mutex_unlock(&st->buf_lock);
>
> - return ret < 0 ? ret : 0;
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> }
>
> static int ade7854_i2c_read_reg(struct device *dev,
> --
> 2.34.1
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-13 12:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-13 5:28 [PATCH v2] staging: iio: meter: replace ternary operator by if condition Deepak R Varma
2022-11-13 13:03 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox