platform/chrome: cros_ec_proto: add Kunit test for getting cmd mask error
authorTzung-Bi Shih <tzungbi@kernel.org>
Thu, 9 Jun 2022 08:49:51 +0000 (08:49 +0000)
committerTzung-Bi Shih <tzungbi@kernel.org>
Fri, 10 Jun 2022 02:31:43 +0000 (02:31 +0000)
commita8f77c63baece8c47599bc418d3c2c138ca7efaf
treed789ebe805b8715cd36c5f27b0a9deef90597a4e
parentf91183aa459a9a06eae6843cde2fbe2d97db4f96
platform/chrome: cros_ec_proto: add Kunit test for getting cmd mask error

cros_ec_query_all() uses cros_ec_get_host_command_version_mask() to
query the supported MKBP version; cros_ec_get_host_command_version_mask()
uses send_command() for transferring the host command.

Returning >=0 from send_command() only denotes the transfer was success.
cros_ec_get_host_command_version_mask() should check if EC wasn't happy
by checking `msg->result`.

Add a Kunit test for returning error in `msg->result` in
cros_ec_get_host_command_version_mask().  For the case,
cros_ec_query_all() should find the EC device doesn't support MKBP.

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220609084957.3684698-16-tzungbi@kernel.org
drivers/platform/chrome/cros_ec_proto_test.c