Bug 13595

Summary: wrong #endif in arch/mips/mipssim/sim_time.c
Product: Platform Specific/Hardware Reporter: dvice_null
Component: MIPSAssignee: ralf
Status: CLOSED CODE_FIX    
Severity: normal CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: latest in git: c277331d5fbaae5772ed19862feefa91f4e477d3 Subsystem:
Regression: No Bisected commit-id:

Description dvice_null 2009-06-21 20:02:02 UTC
In file arch/mips/mipssim/sim_time.c
There is this function:

unsigned __cpuinit get_c0_compare_int(void)
{
#ifdef MSC01E_INT_BASE
	if (cpu_has_veic) {
		set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch);
		mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR;
	} else {
#endif
		if (cpu_has_vint)
			set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
		mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
	}

	return mips_cpu_timer_irq;
}

If MSC01E_INT_BASE is not defined, the code will be:
unsigned __cpuinit get_c0_compare_int(void)
{
		if (cpu_has_vint)
			set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
		mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
	}

	return mips_cpu_timer_irq;
}

As you can see, right before the return, there is }-character without {-character (as it was inside the #ifdef). This can probably be fixed by moving the last {-character before #endif after the #endif. 

This bug was found using Cppcheck: http://cppcheck.wiki.sourceforge.net/