diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c index edbb756c36..cfb08710fb 100644 --- a/hw/misc/imx6_src.c +++ b/hw/misc/imx6_src.c @@ -143,13 +143,17 @@ static void imx6_defer_clear_reset_bit(int cpuid, unsigned long reset_shift) { struct SRCSCRResetInfo *ri; + CPUState *cpu = arm_get_cpu_by_id(cpuid); + + if (!cpu) { + return; + } ri = g_malloc(sizeof(struct SRCSCRResetInfo)); ri->s = s; ri->reset_bit = reset_shift; - async_run_on_cpu(arm_get_cpu_by_id(cpuid), imx6_clear_reset_bit, - RUN_ON_CPU_HOST_PTR(ri)); + async_run_on_cpu(cpu, imx6_clear_reset_bit, RUN_ON_CPU_HOST_PTR(ri)); }