[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yn3l1fJQswi/hOfK@google.com>
Date: Fri, 13 May 2022 13:00:05 +0800
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: Guenter Roeck <groeck@...gle.com>
Cc: Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
chrome-platform@...ts.linux.dev,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/6] platform/chrome: cros_ec_spi: drop BUG_ON()
On Thu, May 12, 2022 at 08:14:10AM -0700, Guenter Roeck wrote:
> On Thu, May 12, 2022 at 1:37 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
> >
> > It is overkill to crash the kernel if the `din` buffer is going to full
> > or overflow.
> >
> > Drop the BUG_ON() and return -EINVAL instead.
> >
> > Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
>
> Wonder if the return code should be -EPROTO instead, but I don't have
> a strong opinion.
Thanks for the review. I am going to split the patch into 2 smaller pieces.
For those related to preamble bytes, at the first glance, they could use
-EPROTO. But, no, they are irrelevant to the protocol. I would drop them.
See [1].
For those `din` isn't large enough, I would keep using -EINVAL as they look
more like the `ec_dev` didn't configure correctly. See [2].
[1]: https://patchwork.kernel.org/project/chrome-platform/patch/20220513044143.1045728-7-tzungbi@kernel.org/
[2]: https://patchwork.kernel.org/project/chrome-platform/patch/20220513044143.1045728-8-tzungbi@kernel.org/
Powered by blists - more mailing lists