mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Fix some warnings
rdmsr.c:616:10: warning: comparison of 0 <= unsigned expression is always true [-Wtautological-compare] if(0 <= val && val <= 7) { // Support 8 P-states ~ ^ ~~~ rdmsr.c:572:8: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if(!multiplier) ^~~~~~~~~~~ rdmsr.c:574:8: note: uninitialized use occurs here if(val > 0) { ^~~ rdmsr.c:572:5: note: remove the 'if' if its condition is always true if(!multiplier) ^~~~~~~~~~~~~~~ rdmsr.c:541:14: note: initialize the variable 'val' to silence this warning uint64_t val; ^ = 0 2 warnings generated.
This commit is contained in:
parent
5272d9f060
commit
aaa7e155a9
1 changed files with 4 additions and 4 deletions
|
@ -569,12 +569,12 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which)
|
|||
{
|
||||
if(cpuid_get_vendor() == VENDOR_INTEL)
|
||||
{
|
||||
if(!multiplier)
|
||||
if(!multiplier) {
|
||||
cpu_rdmsr_range(handle, PLATFORM_INFO_MSR, PLATFORM_INFO_MSR_high, PLATFORM_INFO_MSR_low, &val);
|
||||
if(val > 0) {
|
||||
multiplier = (int) val;
|
||||
return multiplier * 100;
|
||||
}
|
||||
if(multiplier > 0)
|
||||
return multiplier * 100;
|
||||
}
|
||||
err = cpu_rdmsr(handle, 0x198, &r);
|
||||
if (err) return CPU_INVALID_VALUE;
|
||||
|
@ -613,7 +613,7 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which)
|
|||
MSRC001_00[6B:64][15:9] = CpuVid */
|
||||
uint64_t CpuVid;
|
||||
cpu_rdmsr_range(handle, MSR_PSTATE_S, 2, 0, &val);
|
||||
if(0 <= val && val <= 7) { // Support 8 P-states
|
||||
if(val <= 7) { // Support 8 P-states
|
||||
cpu_rdmsr_range(handle, MSR_PSTATE_0 + val, 15, 9, &CpuVid);
|
||||
return (int) (1.550 - 0.0125 * CpuVid) * 100; // 2.4.1.6.3 - Serial VID (SVI) Encodings
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue