[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <65a3989d97b1ae60cfb0749f3ee8bbd625c7beb6.camel@perches.com>
Date: Mon, 09 Sep 2019 17:34:55 -0700
From: Joe Perches <joe@...ches.com>
To: Andreas Klinger <ak@...klinger.de>, jic23@...nel.org,
knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] iio: adc: hx711: remove unnecessary returns
On Sat, 2019-09-07 at 12:18 +0200, Andreas Klinger wrote:
> Optimize use of return in hx711_set_gain_for_channel().
I believe this change is not an optimization but
this change does make the code harder to read.
> diff --git 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)
Powered by blists - more mailing lists