* [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable
@ 2026-01-31 15:16 Sumeet Pawnikar
2026-02-01 13:02 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Sumeet Pawnikar @ 2026-01-31 15:16 UTC (permalink / raw)
To: rafael, daniel.lezcano, rui.zhang, linux-pm; +Cc: linux-kernel, sumeet4linux
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable
2026-01-31 15:16 [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable Sumeet Pawnikar
@ 2026-02-01 13:02 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-02-01 13:02 UTC (permalink / raw)
To: Sumeet Pawnikar; +Cc: rafael, daniel.lezcano, rui.zhang, linux-pm, linux-kernel
On Sat, Jan 31, 2026 at 4:16 PM Sumeet Pawnikar <sumeet4linux@gmail.com> wrote:
>
> 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;
> }
>
> --
Applied as 6.20/7.0 material with some adjustments, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-01 13:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 15:16 [PATCH] drivers: thermal: intel: tcc_cooling: remove unused variable Sumeet Pawnikar
2026-02-01 13:02 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox