diff options
author | Alexander Goncharov <chat@joursoir.net> | 2023-02-14 19:31:44 +0400 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2023-04-24 13:30:12 +0000 |
commit | 5affc221f3074be4e7239ba2a0683cae06b525fd (patch) | |
tree | 49b9d01b929279a5803507d0a83e157c667c9be0 /chipset_enable.c | |
parent | 590a621e164a09b9a435e12ef14800f55cf4805e (diff) | |
download | flashrom-5affc221f3074be4e7239ba2a0683cae06b525fd.tar.gz flashrom-5affc221f3074be4e7239ba2a0683cae06b525fd.tar.bz2 flashrom-5affc221f3074be4e7239ba2a0683cae06b525fd.zip |
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
Reviewed-on: https://review.coreboot.org/c/flashrom/+/73039
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'chipset_enable.c')
0 files changed, 0 insertions, 0 deletions