It's in the file: core.c
In the function: adapter_init

Currently we have from the line: 1371
        jtag = jtag_interface;
        if (jtag_interface->init() != ERROR_OK)
        {
                jtag = NULL;
                return ERROR_JTAG_INIT_FAILED;
        }

We see that the pointer jtag = NULL when an error occurred.

At the end, the adapter be quit:
It's in the file: core.c
In the function: adapter_quit

Currently we have from the line: 1500
        if (!jtag || !jtag->quit)
                return ERROR_OK;

So at the end, when the adapter must be quit, nothing be made if jtag = null even if the jtag adapter is active.


For me, the problem is like a malloc. When we allocate space in memory, it's necessary to deallocate space in memory at the end of program.

So my solution with: ERROR_JTAG_INIT_FAILED_WITH_UNOPEN_DEVICE is an easy and quick patch.



My proposition:
In the file: core.c
In the function: adapter_init
At the line: 1371

        jtag = jtag_interface;
        ret = jtag_interface->init();
        if (ret != ERROR_OK)
        {
                if(ret == ERROR_JTAG_INIT_FAILED_AND_UNOPEN_DEVICE)
                {
                        jtag = NULL;
                }

                return ERROR_JTAG_INIT_FAILED;
        }

So the pointer: jtag is null only if the jtag adapter is inactive.

--
Regards,
Sébastien Farquet
  http://www.amontec.com/
  Amontec JTAGkey-2 : High speed USB JTAG interface
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to