1
0
Fork 0
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:
Xorg 2022-09-25 10:31:54 +02:00
parent 73c33ced4a
commit 967f3ab80d
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A

View file

@ -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;
}