mirror of
https://github.com/anrieff/libcpuid
synced 2024-11-10 22:59:13 +00:00
Improve get_cached_cpuid in case of failure
This commit is contained in:
parent
73c33ced4a
commit
967f3ab80d
1 changed files with 4 additions and 1 deletions
|
@ -217,8 +217,11 @@ struct cpu_id_t* get_cached_cpuid(void)
|
|||
static int initialized = 0;
|
||||
static struct cpu_id_t id;
|
||||
if (initialized) return &id;
|
||||
if (cpu_identify(NULL, &id))
|
||||
if (cpu_identify(NULL, &id) != ERR_OK) {
|
||||
memset(&id, 0, sizeof(id));
|
||||
id.architecture = ARCHITECTURE_UNKNOWN;
|
||||
id.vendor = VENDOR_UNKNOWN;
|
||||
}
|
||||
initialized = 1;
|
||||
return &id;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue