From: David Lechner <dlechner@baylibre.com>
To: Adi Nata <adinata.softwareengineer@gmail.com>,
jic23@kernel.org, nuno.sa@analog.com, andy@kernel.org,
u.kleine-koenig@baylibre.com, mazziesaccount@gmail.com,
bhelgaas@google.com, o-takashi@sakamocchi.jp,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] iio: humidity: htc100c: Fix checkpatch warn unnecessary else
Date: Sun, 2 Aug 2026 09:48:11 -0500 [thread overview]
Message-ID: <f8670ea5-1e76-4a04-9c5e-e43ffac92be0@baylibre.com> (raw)
In-Reply-To: <20260802014417.15485-1-adinata.softwareengineer@gmail.com>
On 8/1/26 8:44 PM, Adi Nata wrote:
> Checkpatch warning:
Making checkpatch happy is not a good reason for a change on it's own.
It is only there for guidance. It is not a strict rule that has to be
followed.
I think this is a good change because it reduces duplication of the
return statements and eliminates an unreachable break statement. So
write the commit message with that reasoning and don't mention checkpatch.
>
> WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return
> + return IIO_VAL_FRACTIONAL;
> + } else {
>
> Signed-off-by: Adi Nata <adinata.softwareengineer@gmail.com>
> ---
> drivers/iio/humidity/hdc100x.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
> index bc452cc8fbcf..38903239fb9a 100644
> --- a/drivers/iio/humidity/hdc100x.c
> +++ b/drivers/iio/humidity/hdc100x.c
> @@ -229,13 +229,11 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
> if (chan->type == IIO_TEMP) {
> *val = 165000;
> *val2 = 65536;
> - return IIO_VAL_FRACTIONAL;
> } else {
> *val = 100000;
> *val2 = 65536;
> - return IIO_VAL_FRACTIONAL;
> }
> - break;
> + return IIO_VAL_FRACTIONAL;
> case IIO_CHAN_INFO_OFFSET:
> *val = -15887;
> *val2 = 515151;
next prev parent reply other threads:[~2026-08-02 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 1:44 [PATCH] iio: humidity: htc100c: Fix checkpatch warn unnecessary else Adi Nata
2026-08-02 14:48 ` David Lechner [this message]
2026-08-02 17:03 ` Jonathan Cameron
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=f8670ea5-1e76-4a04-9c5e-e43ffac92be0@baylibre.com \
--to=dlechner@baylibre.com \
--cc=adinata.softwareengineer@gmail.com \
--cc=andy@kernel.org \
--cc=bhelgaas@google.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=nuno.sa@analog.com \
--cc=o-takashi@sakamocchi.jp \
--cc=u.kleine-koenig@baylibre.com \
/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