]> Git Repo - linux.git/commit
platform/chrome: cros_ec_proto: check for missing EC_CMD_HOST_EVENT_GET_WAKE_MASK
authorBrian Norris <[email protected]>
Fri, 24 Jul 2020 19:08:41 +0000 (12:08 -0700)
committerEnric Balletbo i Serra <[email protected]>
Fri, 31 Jul 2020 10:56:36 +0000 (12:56 +0200)
commitfc8cacf3fc68664e30a6df2b361ae05b9769585e
treefcbd9e429fba50a391a8a3cf8e67e99c38690376
parentc214e564acb2ad9463293ab9c109bfdae91fbeaf
platform/chrome: cros_ec_proto: check for missing EC_CMD_HOST_EVENT_GET_WAKE_MASK

As with cros_ec_cmd_xfer_status(), etc., it's not enough to simply check
for the return status of send_command() -- that only covers transport or
other similarly-fatal errors. One must also check the ->result field, to
see whether the command really succeeded. If not, we can't use the data
it returns.

The caller of cros_ec_get_host_event_wake_mask() ignores this, and so
for example, on EC's where the command is not implemented, we're using
junk (or in practice, all zeros) for our wake-mask. We should be using a
non-zero default (currently, it's supposed to be all-1's).

Fix this by checking the ->result field and returning -EPROTO for
errors.

I might label this as fixing commit 29d99b966d60 ("cros_ec: Don't signal
wake event for non-wake host events"), except that this fix alone
actually may make things worse, as it now allows for a lot more spurious
wakeups. The patch "platform/chrome: cros_ec_proto: ignore battery/AC
wakeups on old ECs" helps to mitigate this.

Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Enric Balletbo i Serra <[email protected]>
drivers/platform/chrome/cros_ec_proto.c
This page took 0.057411 seconds and 4 git commands to generate.