Fail if EC is targeted but no EC is found

This makes the code which calls EC probe functions use the return
code to determine if an EC has been found. If an EC is found then
we can return 0 to indicate success. If not, then we should return 1
to indicate failure so that higher-level code knows to not proceed.

This also updates some EC probe functions to return non-zero if the
EC is not found even under normal/non-error circumstances.

This fixes a bug where "flashrom -p ec" can result in the host ROM
being targeted on platforms without an EC. (Note: The size check
prevents the host ROM from being erased/written, unless the host ROM
was the same size as the EC ROM which is unlikely).

BUG=chrome-os-partner:23617
BRANCH=none
TEST="flashrom -p ec" exits with non-zero code on Beltino and Stumpy
Also tested that "flashrom -p ec" and "flashrom -p host" still target
the correct ROMs on mario, zgb, alex, lumpy, parrot, butterfly, stumpy,
snow, kirby, and link

Change-Id: I210759115c5d784ef564b879b6e973cf4254f5fa
Reviewed-on: https://chromium-review.googlesource.com/175974
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
5 files changed