From: Thorsten Blum <blum@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Thorsten Blum <blum@kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] thermal: intel: int340x: soc_slider: Simplify slider_def_*_set()
Date: Mon, 21 Sep 2026 16:36:41 +0200 [thread overview]
Message-ID: <20260921143644.69381-2-blum@kernel.org> (raw)
Return errors directly to simplify slider_def_balance_set() and
slider_def_offset_set().
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
.../processor_thermal_soc_slider.c | 28 ++++++++++---------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
index 91f291627132..e161b95828e8 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
@@ -66,15 +66,16 @@ static int slider_def_balance_set(const char *arg, const struct kernel_param *kp
guard(mutex)(&slider_param_lock);
ret = kstrtou8(arg, 16, &slider_val);
- if (!ret) {
- if (slider_val <= slider_values[SOC_POWER_SLIDER_PERFORMANCE] ||
- slider_val >= slider_values[SOC_POWER_SLIDER_POWERSAVE])
- return -EINVAL;
+ if (ret)
+ return ret;
- slider_balanced_param = slider_val;
- }
+ if (slider_val <= slider_values[SOC_POWER_SLIDER_PERFORMANCE] ||
+ slider_val >= slider_values[SOC_POWER_SLIDER_POWERSAVE])
+ return -EINVAL;
- return ret;
+ slider_balanced_param = slider_val;
+
+ return 0;
}
static int slider_def_balance_get(char *buf, const struct kernel_param *kp)
@@ -101,14 +102,15 @@ static int slider_def_offset_set(const char *arg, const struct kernel_param *kp)
guard(mutex)(&slider_param_lock);
ret = kstrtou8(arg, 16, &offset);
- if (!ret) {
- if (offset > SOC_SLIDER_VALUE_MAXIMUM)
- return -EINVAL;
+ if (ret)
+ return ret;
- slider_offset = offset;
- }
+ if (offset > SOC_SLIDER_VALUE_MAXIMUM)
+ return -EINVAL;
- return ret;
+ slider_offset = offset;
+
+ return 0;
}
static int slider_def_offset_get(char *buf, const struct kernel_param *kp)
reply other threads:[~2026-09-21 14:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260921143644.69381-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=daniel.lezcano@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.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®