Some comments on the patch:

It would be good if the error handling was cleaned up a bit.

1. Propagate the retval unchange, unless there is a reason not to.
In that case it merits a comment as to why.

retval = foo();
if (retval != ERROR_OK)
{
   // do not modify the value when propagating it.
   return retval;
   // return ERROR_FAIL; // WRONG! (or merits a comment) do not modify
value when propagating
}

2. Use LOG_ERROR() at the site where the error occurs. E.g. not
LOG_USER("Error:"..), but LOG_ERROR("could not xxxx"). You can
also use LOG_ERROR() to elaborate on an error you're propagating to
add a bit of context.

3. Check and propagate error values, e.g. dsp5680xx_ram_to_rom_block()
is missing checks.

4. Perhaps some of the fn's should return void(i.e. can't fail). E.g. queuing
commands to the jtag interface can't fail.

-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 87 40 27

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

Reply via email to