setup_irq() may fail but set_mode doesn't have a way to communicate an error - other than leaving back a half-wrecked system so set_mode is not a good place to do that kind of job.
much like the current code which does not check set_mode either. also, a core that boots and cannot get its clock irq is not half wrecked, its fully wrecked and wont be able to boot anyway.
How about using get_c0_compare_int() for a solution? Currently get_c0_compare_int() can not return an error. If it could return a negative value to indicate the unavailability of an interrupt for cevt-r4k's use, that interrupt would be available for alternative use.
the code could be changed but get_c0_compare_int() returns an unsigned so that would require changing the return value everywhere the function is defined.
i still think that my proposed patch is valid, we could add a panic call if set_mode fails. having your kernel tell you to start an instance of your main clock and not being able to request said irq, does look like a valid cause for a panic() to me
John