drivers: staging: iio: meter: Removed unnecessary variable

Author: Tina Johnson <tinajohnson.1234@gmail.com>

Variable len is used only to store the return value. Hence len is
removed and the return statement modified. Coccinelle was used to
detect such removable variables:

@rule1@
identifier ret;
expression e;
@@

-ret =
+return
           e;
-return ret;

Signed-off-by: Tina Johnson 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/iio/meter/ade7758_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
 
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 7e287da..652aa10 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -485,7 +485,7 @@ static ssize_t ade7758_read_frequency(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
-	int ret, len = 0;
+	int ret;
 	u8 t;
 	int sps;
 
@@ -498,8 +498,7 @@ static ssize_t ade7758_read_frequency(struct device *dev,
 	t = (t >> 5) & 0x3;
 	sps = 26040 / (1 << t);
 
-	len = sprintf(buf, "%d SPS\n", sps);
-	return len;
+	return sprintf(buf, "%d SPS\n", sps);
 }
 
 static ssize_t ade7758_write_frequency(struct device *dev,
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.