From 1d4db3e2cca77a0c963d303fe555a4e3709f7f36 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Fri, 14 Sep 2007 20:21:01 +0000 Subject: [PATCH] The function was missing the case when the stack was used completely, and didn't return a value then. --- cpu/msp430/mtarch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpu/msp430/mtarch.c b/cpu/msp430/mtarch.c index da75c9962..a4cba48ce 100644 --- a/cpu/msp430/mtarch.c +++ b/cpu/msp430/mtarch.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: mtarch.c,v 1.3 2006/09/26 20:56:56 adamdunkels Exp $ + * @(#)$Id: mtarch.c,v 1.4 2007/09/14 20:21:01 nvt-se Exp $ */ #include @@ -139,10 +139,13 @@ int mtarch_stack_usage(struct mt_thread *t) { int i; + for(i = 0; i < MTARCH_STACKSIZE; ++i) { if(t->thread.stack[i] != (unsigned short)i) { return MTARCH_STACKSIZE - i; } } + + return MTARCH_STACKSIZE; } /*--------------------------------------------------------------------------*/