[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220513044143.1045728-5-tzungbi@kernel.org>
Date: Fri, 13 May 2022 12:41:40 +0800
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: bleung@...omium.org, groeck@...omium.org
Cc: chrome-platform@...ts.linux.dev, tzungbi@...nel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 4/7] 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@...omium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
---
Changes from v1:
- Add R-b tag.
drivers/platform/chrome/cros_ec_proto.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 9ce3374846ff..ff767dccdf0f 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -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;
--
2.36.0.550.gb090851708-goog
Powered by blists - more mailing lists