From: "Joaquín Ignacio Aramendía" <samsagax@gmail.com>
To: linux@roeck-us.net
Cc: "Joaquín Ignacio Aramendía" <samsagax@gmail.com>,
derekjohn.clark@gmail.com, jdelvare@suse.com,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return
Date: Sat, 17 Jun 2023 15:11:43 -0300 [thread overview]
Message-ID: <20230617181159.32844-3-samsagax@gmail.com> (raw)
In-Reply-To: <20230617181159.32844-1-samsagax@gmail.com>
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>
---
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;
}
--
2.41.0
next prev parent reply other threads:[~2023-06-17 18:12 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 ` Joaquín Ignacio Aramendía [this message]
2023-06-18 15:54 ` [PATCH 2/2] hwmon: (oxp-sensors) Simplify logic of error return Guenter Roeck
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=20230617181159.32844-3-samsagax@gmail.com \
--to=samsagax@gmail.com \
--cc=derekjohn.clark@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.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®