[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yp6iG75RmirxRMu2@google.com>
Date: Tue, 7 Jun 2022 00:55:55 +0000
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 13/13] platform/chrome: cros_ec_proto: fix
get_host_event_wake_mask() returns
On Mon, Jun 06, 2022 at 09:14:26AM -0700, Guenter Roeck wrote:
> On Mon, Jun 6, 2022 at 7:12 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
> > @@ -256,19 +256,16 @@ static int get_host_event_wake_mask(struct cros_ec_device *ec_dev, uint32_t *mas
> > msg->insize = sizeof(*r);
> >
> > ret = send_command(ec_dev, msg);
> > - if (ret >= 0) {
> > + if (ret > 0) {
>
> The idea here was to (potentially) return an error if ret == 0. This
> is no longer the case after this change. Instead, the caller has to
> check for ret == 0 and treat it as an error. I think it would make
> more sense to explicitly check for ret ==0, eg with something like
>
> mapped = cros_ec_map_error(msg->result);
> if (mapped) {
> ret = mapped;
> goto exit;
> }
> if (ret == 0) {
> ret = -EPROTO;
> goto exit;
> }
> ....
Ack, will fix in next version.
Powered by blists - more mailing lists