platform/x86: intel_ips: remove unused val in read_mgtv
PATCH 1/1 platform/x86: intel_ips: remove unused val in read_mgtv
drivers/platform/x86/intel_ips.c:832:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
832 | u16 ret;
| ^~~Fix it by remove the define.
--- drivers/platform/x86/intel_ips.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/platform/x86/intel_ips.c +2 -13
@@ -829,19 +829,8 @@ static u16 calc_avg_temp(struct ips_driver *ips, u16 *array)static u16 read_mgtv (struct ips_driver *ips) { -u16 ret; -u64 slope, offset; -u64 val; - - val =thm_readq (THM_MGTV ); - val = (val &TV_MASK ) >>TV_SHIFT ; - - slope = offset =thm_readw (THM_MGTA ); - slope = (slope &MGTA_SLOPE_MASK ) >>MGTA_SLOPE_SHIFT ; - offset = offset &MGTA_OFFSET_MASK ; - - ret = ((val * slope +0x40 ) >>7 ) + offset; - +thm_readq (THM_MGTV ); +thm_readw (THM_MGTA );return 0 ;/* MCH temp reporting buggy */ }
Signature · 1 line
2.31.1
Hi,
Quoted 30 lines · yangerkun
drivers/platform/x86/intel_ips.c:832:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]832 | u16 ret; | ^~~Fix it by remove the define.
Reported-by Hulk Robot <[email protected]>Signed-off-by yangerkun <[email protected]>--- drivers/platform/x86/intel_ips.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)drivers/platform/x86/intel_ips.c +0
-8@@ -829,19 +829,8 @@ static u16 calc_avg_temp(struct ips_driver *ips, u16 *array)static u16 read_mgtv (struct ips_driver *ips) { -u16 ret; -u64 slope, offset; -u64 val; - - val =thm_readq (THM_MGTV ); - val = (val &TV_MASK ) >>TV_SHIFT ; - - slope = offset =thm_readw (THM_MGTA );
drivers/platform/x86/intel_ips.c static u16 calc_avg_temp(struct ips_driver *ips, u16 *array) · line 836
Quoted 10 lines
drivers/platform/x86/intel_ips.c +2
-5- slope = (slope &MGTA_SLOPE_MASK ) >>MGTA_SLOPE_SHIFT ; - offset = offset &MGTA_OFFSET_MASK ; - - ret = ((val * slope +0x40 ) >>7 ) + offset; - +thm_readq (THM_MGTV ); +thm_readw (THM_MGTA );return 0 ;/* MCH temp reporting buggy */ }
I believe it would be good to keep the code around to document how the temperature can be calculated.
Please submit a patch marking ret as __maybe_unused instead.
Regards,
Hans
Quoted 48 lines · Hans de Goede
Hi,
Quoted 30 lines · yangerkun
drivers/platform/x86/intel_ips.c:832:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]832 | u16 ret; | ^~~Fix it by remove the define.
Reported-by Hulk Robot <[email protected]>Signed-off-by yangerkun <[email protected]>--- drivers/platform/x86/intel_ips.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)drivers/platform/x86/intel_ips.c +0
-8@@ -829,19 +829,8 @@ static u16 calc_avg_temp(struct ips_driver *ips, u16 *array)static u16 read_mgtv (struct ips_driver *ips) { -u16 ret; -u64 slope, offset; -u64 val; - - val =thm_readq (THM_MGTV ); - val = (val &TV_MASK ) >>TV_SHIFT ; - - slope = offset =thm_readw (THM_MGTA );drivers/platform/x86/intel_ips.c static u16 calc_avg_temp(struct ips_driver *ips, u16 *array) · line 836
Quoted 10 lines
drivers/platform/x86/intel_ips.c +2
-5- slope = (slope &MGTA_SLOPE_MASK ) >>MGTA_SLOPE_SHIFT ; - offset = offset &MGTA_OFFSET_MASK ; - - ret = ((val * slope +0x40 ) >>7 ) + offset; - +thm_readq (THM_MGTV ); +thm_readw (THM_MGTA );return 0 ;/* MCH temp reporting buggy */ }I believe it would be good to keep the code around to document how the temperature can be calculated.
Quoted 1 line
Please submit a patch marking ret as
__maybe_unusedinstead.
Thanks for your reply, will send v2.
Quoted 7 lines
Regards,
Hans
.