Attention is currently required from: Edward O'Callaghan, Angel Pons, Alexander Goncharov.

Alexander Goncharov uploaded patch set #7 to this change.

View Change

flashrom: rewrite flashbuses_to_text()

The previous implementation had no error handling, as a result the
flashrom could crash if the computer ran out of memory. The new
version returns NULL in such cases.

Also, rewrite lots of `if` conditions to one cycle, store a name of
buses and `enum chipbustype` in an array by using a custom struct.

The caller always expected a non-null value, so change its behavior to
handle a possible null value or use the `?` symbol. As far as `free()`
can handle null pointers, do nothing with such callers.

TEST=ninja test

Change-Id: I59b9044c99b4ba6c00d8c97f1e91af09d70dce2c
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Ticket: https://ticket.coreboot.org/issues/408
---
M cli_classic.c
M flashrom.c
M print.c
M print_wiki.c
4 files changed, 78 insertions(+), 23 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/39/73039/7

To view, visit change 73039. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I59b9044c99b4ba6c00d8c97f1e91af09d70dce2c
Gerrit-Change-Number: 73039
Gerrit-PatchSet: 7
Gerrit-Owner: Alexander Goncharov <chat@joursoir.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Alexander Goncharov <chat@joursoir.net>
Gerrit-MessageType: newpatchset