mirror of
https://github.com/anrieff/libcpuid
synced 2025-07-12 14:14:12 +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 int initialized = 0;
|
||||||
static struct cpu_id_t id;
|
static struct cpu_id_t id;
|
||||||
if (initialized) return &id;
|
if (initialized) return &id;
|
||||||
if (cpu_identify(NULL, &id))
|
if (cpu_identify(NULL, &id) != ERR_OK) {
|
||||||
memset(&id, 0, sizeof(id));
|
memset(&id, 0, sizeof(id));
|
||||||
|
id.architecture = ARCHITECTURE_UNKNOWN;
|
||||||
|
id.vendor = VENDOR_UNKNOWN;
|
||||||
|
}
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
return &id;
|
return &id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue