mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
layout: Add a method to cleanup layout data structures
Add layout_cleanup() to layout.c and hook it up in cli_classic.c. Corresponding to flashrom svn r1749. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
88ee040ab9
commit
949ccc8a7e
@ -221,8 +221,6 @@ int main(int argc, char *argv[])
|
|||||||
free(tempstr);
|
free(tempstr);
|
||||||
cli_classic_abort_usage();
|
cli_classic_abort_usage();
|
||||||
}
|
}
|
||||||
/* FIXME: A pointer to the image name is saved in a static array (of size MAX_ROMLAYOUT)
|
|
||||||
* by register_include_arg() and needs to be freed after processing them. */
|
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
if (++operation_specified > 1) {
|
if (++operation_specified > 1) {
|
||||||
@ -527,6 +525,7 @@ out:
|
|||||||
for (i = 0; i < chipcount; i++)
|
for (i = 0; i < chipcount; i++)
|
||||||
free(flashes[i].chip);
|
free(flashes[i].chip);
|
||||||
|
|
||||||
|
layout_cleanup();
|
||||||
free(filename);
|
free(filename);
|
||||||
free(layoutfile);
|
free(layoutfile);
|
||||||
free(pparam);
|
free(pparam);
|
||||||
|
1
flash.h
1
flash.h
@ -320,6 +320,7 @@ int register_include_arg(char *name);
|
|||||||
int process_include_args(void);
|
int process_include_args(void);
|
||||||
int read_romlayout(char *name);
|
int read_romlayout(char *name);
|
||||||
int handle_romentries(const struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
|
int handle_romentries(const struct flashctx *flash, uint8_t *oldcontents, uint8_t *newcontents);
|
||||||
|
void layout_cleanup(void);
|
||||||
|
|
||||||
/* spi.c */
|
/* spi.c */
|
||||||
struct spi_command {
|
struct spi_command {
|
||||||
|
16
layout.c
16
layout.c
@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 coresystems GmbH
|
* Copyright (C) 2005-2008 coresystems GmbH
|
||||||
* (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
|
* (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
|
||||||
|
* Copyright (C) 2011-2013 Stefan Tauner
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -189,6 +190,21 @@ int process_include_args(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void layout_cleanup(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < num_include_args; i++) {
|
||||||
|
free(include_args[i]);
|
||||||
|
include_args[i] = NULL;
|
||||||
|
}
|
||||||
|
num_include_args = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < num_rom_entries; i++) {
|
||||||
|
rom_entries[i].included = 0;
|
||||||
|
}
|
||||||
|
num_rom_entries = 0;
|
||||||
|
}
|
||||||
|
|
||||||
romentry_t *get_next_included_romentry(unsigned int start)
|
romentry_t *get_next_included_romentry(unsigned int start)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user