From: Jonathan Cameron <jic23@kernel.org>
To: Andreas Klinger <ak@it-klinger.de>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] iio: adc: hx711: remove unnecessary returns
Date: Sun, 15 Sep 2019 13:58:02 +0100 [thread overview]
Message-ID: <20190915135802.4051574e@archlinux> (raw)
In-Reply-To: <20190909123806.ewrxc7y5gmh5plmk@arbad>
On Mon, 9 Sep 2019 14:38:08 +0200
Andreas Klinger <ak@it-klinger.de> wrote:
> Optimize use of return in hx711_set_gain_for_channel().
>
> Signed-off-by: Andreas Klinger <ak@it-klinger.de>
I agree with Joe on this. Minor reduction in code, but hurts
readability so a no on this one.
thanks,
Jonathan
> ---
> 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)
prev parent reply other threads:[~2019-09-15 12:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 12:38 [PATCH v2 3/3] iio: adc: hx711: remove unnecessary returns Andreas Klinger
2019-09-15 12:58 ` Jonathan Cameron [this message]
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=20190915135802.4051574e@archlinux \
--to=jic23@kernel.org \
--cc=ak@it-klinger.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.