Re: [PATCH] platform/x86: intel_ips: remove unused val in read_mgtv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 6/4/21 10:14 AM, yangerkun wrote:
> 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 <hulkci@xxxxxxxxxx>
> Signed-off-by: yangerkun <yangerkun@xxxxxxxxxx>
> ---
>  drivers/platform/x86/intel_ips.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> index bffe548187ee..d40a00ba859a 100644
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -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 */
>  }
>  
> 


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




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux