From: Guenter Roeck <linux@roeck-us.net>
To: "Joaquín Ignacio Aramendía" <samsagax@gmail.com>
Cc: derekjohn.clark@gmail.com, jdelvare@suse.com,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return
Date: Sun, 18 Jun 2023 08:54:56 -0700 [thread overview]
Message-ID: <1c7961f5-a7d0-4c9d-a25d-6929ec4ea2da@roeck-us.net> (raw)
In-Reply-To: <20230617181159.32844-3-samsagax@gmail.com>
On Sat, Jun 17, 2023 at 03:11:43PM -0300, Joaquín Ignacio Aramendía wrote:
> Take return logic on error out of if-else, eliminating
> duplicated code in tt_togle_store() function.
>
> Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/oxp-sensors.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
> index 584e48d8106e..1e59d97219c4 100644
> --- a/drivers/hwmon/oxp-sensors.c
> +++ b/drivers/hwmon/oxp-sensors.c
> @@ -226,13 +226,12 @@ static ssize_t tt_toggle_store(struct device *dev,
>
> if (value) {
> rval = tt_toggle_enable();
> - if (rval)
> - return rval;
> } else {
> rval = tt_toggle_disable();
> - if (rval)
> - return rval;
> }
> + if (rval)
> + return rval;
> +
> return count;
> }
>
prev parent reply other threads:[~2023-06-18 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-17 18:11 [PATCH 0/2] hwmon: (oxp-sensors) Minor cleanup of driver code Joaquín Ignacio Aramendía
2023-06-17 18:11 ` [PATCH 1/2] hwmon: (oxp-sensors) Remove unused header Joaquín Ignacio Aramendía
2023-06-18 15:54 ` Guenter Roeck
2023-06-17 18:11 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Joaquín Ignacio Aramendía
2023-06-18 15:54 ` Guenter Roeck [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=1c7961f5-a7d0-4c9d-a25d-6929ec4ea2da@roeck-us.net \
--to=linux@roeck-us.net \
--cc=derekjohn.clark@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samsagax@gmail.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
all inboxes | Powered by JetHome®