Fix warnings in coreboot utilities.
- Fix some poor programming practice (breaks of strict aliasing as well as not checking the return value of read) - Use PRIx64 instead of %llx to prevent compilation warnings with both 32bit and 64bit compilers - Use same compiler command options when linking inteltool and when detecting libpci for inteltool Change-Id: I08b2e8d1bbc908f6b1f26d25cb3a4b03d818e124 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/752 Tested-by: build bot (Jenkins) Reviewed-by: Mathias Krause <minipli@googlemail.com>
This commit is contained in:
committed by
Stefan Reinauer
parent
8acbc2a886
commit
a7b296d450
@@ -57,7 +57,7 @@ int msr_readerror = 0;
|
||||
|
||||
msr_t rdmsr(int addr)
|
||||
{
|
||||
uint8_t buf[8];
|
||||
uint32_t buf[2];
|
||||
msr_t msr = { 0xffffffff, 0xffffffff };
|
||||
|
||||
if (lseek(fd_msr, (off_t) addr, SEEK_SET) == -1) {
|
||||
@@ -67,9 +67,8 @@ msr_t rdmsr(int addr)
|
||||
}
|
||||
|
||||
if (read(fd_msr, buf, 8) == 8) {
|
||||
msr.lo = *(uint32_t *)buf;
|
||||
msr.hi = *(uint32_t *)(buf + 4);
|
||||
|
||||
msr.lo = buf[0];
|
||||
msr.hi = buf[1];
|
||||
return msr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user