platform/chrome: cros_ec_proto: drop BUG_ON() in cros_ec_get_host_event()
authorTzung-Bi Shih <tzungbi@kernel.org>
Fri, 13 May 2022 04:41:40 +0000 (12:41 +0800)
committerTzung-Bi Shih <tzungbi@kernel.org>
Mon, 16 May 2022 02:01:51 +0000 (10:01 +0800)
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
drivers/platform/chrome/cros_ec_proto.c

index 9ce3374..ff767dc 100644 (file)
@@ -817,7 +817,8 @@ u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev)
 {
        u32 host_event;
 
-       BUG_ON(!ec_dev->mkbp_event_supported);
+       if (!ec_dev->mkbp_event_supported)
+               return 0;
 
        if (ec_dev->event_data.event_type != EC_MKBP_EVENT_HOST_EVENT)
                return 0;