diff mbox series

[1/6] platform/chrome: cros_ec_proto: drop unneeded BUG_ON() in prepare_packet()

Message ID 20220512083627.885338-2-tzungbi@kernel.org (mailing list archive)
State Superseded
Headers show
Series platform/chrome: get rid of BUG_ON() | expand

Commit Message

Tzung-Bi Shih May 12, 2022, 8:36 a.m. UTC
prepare_packet() gets called if `ec_dev->proto_version` > 2.  For now, it
must be equivalent to EC_HOST_REQUEST_VERSION.

Drop the BUG_ON().

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/platform/chrome/cros_ec_proto.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Guenter Roeck May 12, 2022, 2:53 p.m. UTC | #1
On Thu, May 12, 2022 at 1:36 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> prepare_packet() gets called if `ec_dev->proto_version` > 2.  For now, it
> must be equivalent to EC_HOST_REQUEST_VERSION.
>
> Drop the BUG_ON().
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

An alternative would be to return -EPROTO, but given the context this
is just a waste of code space.

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/platform/chrome/cros_ec_proto.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index ac1419881ff3..db1c8ba43171 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -60,7 +60,6 @@ static int prepare_packet(struct cros_ec_device *ec_dev,
>         int i;
>         u8 csum = 0;
>
> -       BUG_ON(ec_dev->proto_version != EC_HOST_REQUEST_VERSION);
>         BUG_ON(msg->outsize + sizeof(*request) > ec_dev->dout_size);
>
>         out = ec_dev->dout;
> --
> 2.36.0.512.ge40c2bad7a-goog
>
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index ac1419881ff3..db1c8ba43171 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -60,7 +60,6 @@  static int prepare_packet(struct cros_ec_device *ec_dev,
 	int i;
 	u8 csum = 0;
 
-	BUG_ON(ec_dev->proto_version != EC_HOST_REQUEST_VERSION);
 	BUG_ON(msg->outsize + sizeof(*request) > ec_dev->dout_size);
 
 	out = ec_dev->dout;