From: Andreas Klinger <ak@it-klinger.de>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] iio: adc: hx711: remove unnecessary returns
Date: Sat, 7 Sep 2019 12:18:50 +0200 [thread overview]
Message-ID: <20190907101848.hl4vgaostftr4ddj@arbad> (raw)
Optimize use of return in hx711_set_gain_for_channel().
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
---
drivers/iio/adc/hx711.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index c8686558429b..20c249f502c0 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -213,7 +213,7 @@ static int hx711_reset(struct hx711_data *hx711_data)
static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan)
{
- int ret;
+ int ret = 0;
if (chan == 0) {
if (hx711_data->gain_set == 32) {
@@ -224,8 +224,6 @@ static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan)
return ret;
ret = hx711_wait_for_ready(hx711_data);
- if (ret)
- return ret;
}
} else {
if (hx711_data->gain_set != 32) {
@@ -236,12 +234,10 @@ static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan)
return ret;
ret = hx711_wait_for_ready(hx711_data);
- if (ret)
- return ret;
}
}
- return 0;
+ return ret;
}
static int hx711_reset_read(struct hx711_data *hx711_data, int chan)
--
2.13.3
next reply other threads:[~2019-09-07 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-07 10:18 Andreas Klinger [this message]
2019-09-10 0:34 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190907101848.hl4vgaostftr4ddj@arbad \
--to=ak@it-klinger.de \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®