Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67752 )
Change subject: internal.c: Pass `programmer_cfg` to `try_mtd()` ......................................................................
internal.c: Pass `programmer_cfg` to `try_mtd()`
Programmer params are now passed via the `programmer_cfg` struct, but the internal programmer did not pass them to the `try_mtd()` function which was still using `NULL`. This problem resulted in a segmentation fault when trying to use the internal programmer.
TEST=Make sure internal programmer does not segfault on Haswell ULT.
Change-Id: I9e74bd68a1f9509a201dc518dbff96c27d68a3c3 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M include/programmer.h M internal.c 2 files changed, 24 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/52/67752/1
diff --git a/include/programmer.h b/include/programmer.h index a7cea5e..17abfd2 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -375,12 +375,15 @@ void probe_superio_ite(void); int init_superio_ite(const struct programmer_cfg *cfg);
-#if CONFIG_LINUX_MTD == 1 /* trivial wrapper to avoid cluttering internal_init() with #if */ -static inline int try_mtd(void) { return programmer_linux_mtd.init(NULL); }; +static inline int try_mtd(const struct programmer_cfg *cfg) +{ +#if CONFIG_LINUX_MTD == 1 + return programmer_linux_mtd.init(cfg); #else -static inline int try_mtd(void) { return 1; }; + return 1; #endif +}
/* mcp6x_spi.c */ int mcp6x_spi_init(int want_spi); diff --git a/internal.c b/internal.c index 43aa51b..6a8db5e 100644 --- a/internal.c +++ b/internal.c @@ -215,7 +215,7 @@ */ internal_buses_supported = BUS_NONSPI;
- if (try_mtd() == 0) { + if (try_mtd(cfg) == 0) { ret = 0; goto internal_init_exit; }