Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: cros_ec_proto: drop BUG_ON() in cros_ec_get_host_event()

It is overkill to crash the kernel if the `ec_dev` doesn't support MKBP
event but gets called into cros_ec_get_host_event().

Drop the BUG_ON() and return error (0 in the case) instead.

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220513044143.1045728-5-tzungbi@kernel.org

+2 -1
+2 -1
drivers/platform/chrome/cros_ec_proto.c
··· 817 817 { 818 818 u32 host_event; 819 819 820 - BUG_ON(!ec_dev->mkbp_event_supported); 820 + if (!ec_dev->mkbp_event_supported) 821 + return 0; 821 822 822 823 if (ec_dev->event_data.event_type != EC_MKBP_EVENT_HOST_EVENT) 823 824 return 0;