From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sven Schnelle Date: Tue, 04 Oct 2011 16:37:50 +0200 Subject: [U-Boot] [PATCH] AVR32: fix timer_init() function In-Reply-To: ("Andreas =?utf-8?Q?Bie=C3=9Fmann=22's?= message of "Tue\, 4 Oct 2011 15\:39\:18 +0200") References: <1317720000-15183-1-git-send-email-svens@stackframe.org> Message-ID: <871uus4ybl.fsf@begreifnix.stackframe.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Andreas Bie?mann writes: >> - if (set_interrupt_handler(0, &timer_interrupt_handler, 3)) >> - return; >> + if ((ret = set_interrupt_handler(0, &timer_interrupt_handler, 3))) >> + return ret; > can you do it like this: > > ret = set_interrupt_handler(); > if (ret) > return ret; Sure, modified patch attached. Thanks! -- AVR32: fix timer_init() function timer_init() now returns an int (the error code) instead of void. This makes compilation fail with: interrupts.c:111: error: conflicting types for 'timer_init' /home/svens/u-boot/u-boot/include/common.h:246: error: previous declaration of 'timer_init' was here make[1]: *** [interrupts.o] Error 1 Signed-off-by: Sven Schnelle --- arch/avr32/cpu/interrupts.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c index 6681e13..97910b3 100644 --- a/arch/avr32/cpu/interrupts.c +++ b/arch/avr32/cpu/interrupts.c @@ -107,10 +107,11 @@ static int set_interrupt_handler(unsigned int nr, void (*handler)(void), return 0; } -void timer_init(void) +int timer_init(void) { extern void timer_interrupt_handler(void); u64 tmp; + int ret; sysreg_write(COUNT, 0); @@ -119,9 +120,11 @@ void timer_init(void) do_div(tmp, gd->cpu_hz); tb_factor = (u32)tmp; - if (set_interrupt_handler(0, &timer_interrupt_handler, 3)) - return; + ret = set_interrupt_handler(0, &timer_interrupt_handler, 3); + if (ret) + return ret; /* For all practical purposes, this gives us an overflow interrupt */ sysreg_write(COMPARE, 0xffffffff); + return 0; } -- 1.7.6.3