cpu/x86/mp_init.c: Improve AP entry point
Make sure that a pointer exists before dereferencing it. Change-Id: I1a9833bb9686451224249efe599346f64dc37874 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70011 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
parent
3c8a3d1295
commit
db65dd60fb
|
@ -182,9 +182,16 @@ static asmlinkage void ap_init(unsigned int index)
|
||||||
enable_lapic();
|
enable_lapic();
|
||||||
setup_lapic_interrupts();
|
setup_lapic_interrupts();
|
||||||
|
|
||||||
struct device *dev = g_cpu_bus->children;
|
struct device *dev;
|
||||||
for (unsigned int i = index; i > 0; i--)
|
int i = 0;
|
||||||
dev = dev->sibling;
|
for (dev = g_cpu_bus->children; dev; dev = dev->sibling)
|
||||||
|
if (i++ == index)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!dev) {
|
||||||
|
printk(BIOS_ERR, "Could not find allocated device for index %u\n", index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set_cpu_info(index, dev);
|
set_cpu_info(index, dev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue