Revision c3203fa5

b/hw/openpic.c
161 161

  
162 162
static int get_current_cpu(void)
163 163
{
164
  return cpu_single_env->cpu_index;
164
    if (!cpu_single_env) {
165
        return -1;
166
    }
167

  
168
    return cpu_single_env->cpu_index;
165 169
}
166 170

  
167 171
static uint32_t openpic_cpu_read_internal(void *opaque, hwaddr addr,
......
810 814

  
811 815
    DPRINTF("%s: cpu %d addr " TARGET_FMT_plx " <= %08x\n", __func__, idx,
812 816
            addr, val);
817

  
818
    if (idx < 0) {
819
        return;
820
    }
821

  
813 822
    if (addr & 0xF)
814 823
        return;
815 824
    dst = &opp->dst[idx];
......
875 884

  
876 885
    DPRINTF("%s: cpu %d addr " TARGET_FMT_plx "\n", __func__, idx, addr);
877 886
    retval = 0xFFFFFFFF;
887

  
888
    if (idx < 0) {
889
        return retval;
890
    }
891

  
878 892
    if (addr & 0xF)
879 893
        return retval;
880 894
    dst = &opp->dst[idx];

Also available in: Unified diff