lib/flashrom_drv.c: Handle empty regions array correctly.

flashrom_write_image() branches on whether specific regions have been
requested: if no regions are requested, then the layout is left as the
default, resulting in the whole image being selected; otherwise, only
the specified regions are selected. However, currently there is an edge
case of specifying a non-null, but empty array for regions; this results
in the regions codepath being taken, but no regions being selected,
resulting in a no-op.

Update the condition to treat an empty array the same as a null array,
resulting in the whole image codepath being taken for default EC
updates.

BUG=b:285071263
TEST=chromeos-firmwareupdate -m recovery updates the EC on yaviks
BRANCH=None

Signed-off-by: Sam McNally <sammc@chromium.org>
Change-Id: Ibcc023fa42b1b62c539720b0c0a5ac9091298b16
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4583727
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
1 file changed