See patch.
Uwe.
On 23.06.2009 23:10, Uwe Hermann wrote:
Properly check whether get_io_perms() worked and propagate errors (if any).
Also, call programmer_shutdown() whenever we exit(). Actually, programmer_shutdown() was not called in most cases at all for any of the (external) programmers until now. You can check that by comparing 'flashrom -p dummy -V' output.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de
Index: flashrom.c
--- flashrom.c (Revision 627) +++ flashrom.c (Arbeitskopie) @@ -712,10 +712,11 @@ if (optind < argc) filename = argv[optind++];
- ret = programmer_init();
- myusec_calibrate_delay();
- if ((ret = programmer_init()) < 0)
exit(1);
The hunk above doesn't apply anymore. The code in SVN head does mostly what we need, but moving delay calibration before programmer_init() is still needed.
@@ -729,6 +730,7 @@ for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) printf(" %s", flashes[i]->name); printf("\nPlease specify which chip to use with the -c <chipname> option.\n");
exit(1);programmer_shutdown();
The repeated programmer_shutdown(); exit(1); pattern makes it clear that we need a function exit_and_shutdown(int exitcode). That function should replace exit() almost everywhere.
Regards, Carl-Daniel
Carl-Daniel Hailfinger wrote:
@@ -729,6 +730,7 @@ for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++) printf(" %s", flashes[i]->name); printf("\nPlease specify which chip to use with the -c <chipname> option.\n");
exit(1);programmer_shutdown();
The repeated programmer_shutdown(); exit(1); pattern makes it clear that we need a function exit_and_shutdown(int exitcode). That function should replace exit() almost everywhere.
Maybe programmer_shutdown should be hooked into the exit handler using atexit(3)? I don't think it's necessary (nor desirable) to exchange exit() by something else, given libc provides us some pretty nice mechanisms here.
Stefan