lkml.org 
[lkml]   [2022]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@kernel.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@kernel.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/

\
 
 \ /
  Last update: 2022-05-13 07:01    [W:0.090 / U:1.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site