public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sumeet Pawnikar <sumeet4linux@gmail.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org,
	rui.zhang@intel.com, linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, sumeet4linux@gmail.com
Subject: [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable
Date: Sat, 31 Jan 2026 20:46:15 +0530	[thread overview]
Message-ID: <20260131151615.6230-1-sumeet4linux@gmail.com> (raw)

Remove the unused variable 'ret' in tcc_cooling_init() and simplify the
error handling path. The variable 'ret' was declared but only used to
store the return value of PTR_ERR(tcc_cdev) before immediately returning
it, which is redundant.

Remove the duplicate variable declaration where both 'ret' and 'err' were
declared, but only 'err' was actually needed.
Also, simplify the error path by directly returning PTR_ERR(tcc_cdev)
instead of storing it in an intermediate variable.

Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
---
 drivers/thermal/intel/intel_tcc_cooling.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/intel/intel_tcc_cooling.c b/drivers/thermal/intel/intel_tcc_cooling.c
index f352ecafbedf..a5b31b25225e 100644
--- a/drivers/thermal/intel/intel_tcc_cooling.c
+++ b/drivers/thermal/intel/intel_tcc_cooling.c
@@ -72,12 +72,10 @@ MODULE_DEVICE_TABLE(x86cpu, tcc_ids);
 
 static int __init tcc_cooling_init(void)
 {
-	int ret;
+	int err;
 	u64 val;
 	const struct x86_cpu_id *id;
 
-	int err;
-
 	id = x86_match_cpu(tcc_ids);
 	if (!id)
 		return -ENODEV;
@@ -103,10 +101,9 @@ static int __init tcc_cooling_init(void)
 	tcc_cdev =
 	    thermal_cooling_device_register("TCC Offset", NULL,
 					    &tcc_cooling_ops);
-	if (IS_ERR(tcc_cdev)) {
-		ret = PTR_ERR(tcc_cdev);
-		return ret;
-	}
+	if (IS_ERR(tcc_cdev))
+		return PTR_ERR(tcc_cdev);
+
 	return 0;
 }
 
-- 
2.43.0


             reply	other threads:[~2026-01-31 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-31 15:16 Sumeet Pawnikar [this message]
2026-02-01 13:02 ` [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable Rafael J. Wysocki

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=20260131151615.6230-1-sumeet4linux@gmail.com \
    --to=sumeet4linux@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@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