• Paul Cercueil's avatar
    MIPS: cpu-probe: ingenic: Fix broken BUG_ON · 5f5ed0eb
    Paul Cercueil authored
    The previous code was doing:
    BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter);
    
    This only worked as the "cpu_has_counter" macro was overridden in
    <cpu-feature-overrides.h>. The default "cpu_has_counter" macro is
    non-constant, which triggered the BUG_ON() independently of the value
    returned by the macro.
    
    What we want to check here, is that *if* the macro was overridden to a
    compile-time constant, then must be defined to zero, otherwise it's a
    bug.
    
    So the correct check is:
    BUG_ON(__builtin_constant_p(cpu_has_counter) && cpu_has_counter);
    Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
    Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
    5f5ed0eb
cpu-probe.c 62.1 KB