summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTina Johnson <tinajohnson.1234@gmail.com>2014-09-14 16:30:05 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 16:23:51 -0700
commit9034720a54738bbaf96b619f34f887199ac7efed (patch)
tree6cba6b89b744cadb7a069f71fe71ec6c8f8c666d
parent496a51bd64eb15f14cee3519f5b75b28d09567e3 (diff)
downloadlinux-9034720a54738bbaf96b619f34f887199ac7efed.tar.gz
linux-9034720a54738bbaf96b619f34f887199ac7efed.tar.bz2
linux-9034720a54738bbaf96b619f34f887199ac7efed.zip
Staging: iio: meter: ade7753: Merged assignment with immediately following return statement
Saved one line of code by merging the assigning and return statements of variable ret. And thus removed variable len which was no longer useful. This patch was done using Coccinelle script and the following semantic patch was used: @@ expression ret; identifier f; @@ -ret = +return f(...); -return ret; Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Acked-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/meter/ade7753.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index 00492cad7c57..7161c61fc6eb 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -377,7 +377,7 @@ static ssize_t ade7753_read_frequency(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- int ret, len = 0;
+ int ret;
u16 t;
int sps;
ret = ade7753_spi_read_reg_16(dev, ADE7753_MODE, &t);
@@ -387,8 +387,7 @@ static ssize_t ade7753_read_frequency(struct device *dev,
t = (t >> 11) & 0x3;
sps = 27900 / (1 + t);
- len = sprintf(buf, "%d\n", sps);
- return len;
+ return sprintf(buf, "%d\n", sps);
}
static ssize_t ade7753_write_frequency(struct device *dev,