drivers: thermal: intel: tcc_cooling: remove unused variable
PATCH 1/1 drivers: thermal: intel: tcc_cooling: remove unused variable
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.
--- drivers/thermal/intel/intel_tcc_cooling.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/thermal/intel/intel_tcc_cooling.c +4 -7
@@ -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 ; }
Signature · 1 line
2.43.0
Quoted 39 lines · Sumeet Pawnikar
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 ofPTR_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 returningPTR_ERR(tcc_cdev)instead of storing it in an intermediate variable.Signed-off-by Sumeet Pawnikar <[email protected]>--- drivers/thermal/intel/intel_tcc_cooling.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/thermal/intel/intel_tcc_cooling.c +1
-4@@ -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)) {
drivers/thermal/intel/intel_tcc_cooling.c static int __init tcc_cooling_init(void)
Quoted 10 lines
drivers/thermal/intel/intel_tcc_cooling.c +3
-4- 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!