public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: iio: meter: use min() for comparison and assignment
@ 2022-11-07  4:10 Deepak R Varma
  2022-11-07 13:08 ` Dan Carpenter
  2022-11-08 15:12 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 9+ messages in thread
From: Deepak R Varma @ 2022-11-07  4:10 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Greg Kroah-Hartman, linux-iio, linux-staging, linux-kernel

Simplify code by using recommended min helper macro for logical
evaluation and value assignment. This issue is identified by
coccicheck using the minmax.cocci file.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/staging/iio/meter/ade7854-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
index a9a06e8dda51..a6ce7b24cc8f 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -61,7 +61,7 @@ static int ade7854_i2c_write_reg(struct device *dev,
 unlock:
 	mutex_unlock(&st->buf_lock);

-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }

 static int ade7854_i2c_read_reg(struct device *dev,
--
2.34.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-11-12 16:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07  4:10 [PATCH] staging: iio: meter: use min() for comparison and assignment Deepak R Varma
2022-11-07 13:08 ` Dan Carpenter
2022-11-07 15:15   ` Deepak R Varma
2022-11-07 15:22   ` Joe Perches
2022-11-07 15:38     ` Dan Carpenter
2022-11-07 16:27       ` Deepak R Varma
2022-11-08 15:12 ` Greg Kroah-Hartman
2022-11-08 15:36   ` Deepak R Varma
2022-11-12 16:35     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox