[coreboot] [PATCH] flashrom: Call programmer_shutdown() where needed
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Thu Jul 9 02:52:11 CEST 2009
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 at 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");
> + programmer_shutdown();
> exit(1);
>
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
--
http://www.hailfinger.org/
More information about the coreboot
mailing list