On Tue, Nov 9, 2010 at 12:05 PM, Peter Stuge <pe...@stuge.se> wrote: > Øyvind Harboe wrote: >> >> + if (detected_failure != ERROR_OK) >> >> + return detected_failure; >> >> + return retval; >> > >> > Please just use retval also for the error. >> >> I'm not sure what you mean. I'm detecting an error, >> then running cleanup, which can also fail and is using >> retval. After the cleanup has happened, I report the >> original error. > > A function can only ever return one value. If cleanup fails then the > value of retval becomes irrelevant, so can easily use just a single > variable for the single purpose of storing the return value for the > function.
Reading over the code, I can't match up what you write. The normal behavior is: - detect and report failure. This is a failure that has occurred in the hardware previously, there is no error condition currently. The current function executes without any error as such. - once this error is detected, continue with the rest of the polling code. If an error was detected(which may have occurred millions of cycles before the current fn was even invoked), then report that error at the end of the fn. -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 63 25 00 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development