From: Benson Leung <bleung@google.com>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Lee Jones <lee.jones@linaro.org>,
linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Gwendal Grignou <gwendal@chromium.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
vpalatin@chromium.org
Subject: Re: [PATCH] mfd: cros_ec_dev: Don't advertise junk features on failure
Date: Thu, 31 May 2018 10:00:24 -0700 [thread overview]
Message-ID: <20180531170024.GA56777@decatoncale.mtv.corp.google.com> (raw)
In-Reply-To: <20180531062343.243720-1-swboyd@chromium.org>
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
Hi Stephen,
On Wed, May 30, 2018 at 11:23:43PM -0700, Stephen Boyd wrote:
> If the feature query fails during this driver's probe, we memset the
> features bits to 0, but then we continue to overwrite that with whatever
> junk we read back when the feature probing failed. In the case of a SPI
> device, it may be complete junk, causing the caller of this function to
> think certain features are present when they aren't. Don't copy over the
> bad message on failure so we can fail more gracefully.
>
> Fixes: e4244ebddae2 ("platform/chrome: Introduce a new function to check EC features.")
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Benson Leung <bleung@chromium.org>
> ---
> drivers/mfd/cros_ec_dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 1d6dc5c7a19d..d37c79426c87 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -113,10 +113,10 @@ static int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
> dev_warn(ec->dev, "cannot get EC features: %d/%d\n",
> ret, msg->result);
> memset(ec->features, 0, sizeof(ec->features));
> + } else {
> + memcpy(ec->features, msg->data, sizeof(ec->features));
> }
>
> - memcpy(ec->features, msg->data, sizeof(ec->features));
> -
> dev_dbg(ec->dev, "EC features %08x %08x\n",
> ec->features[0], ec->features[1]);
>
> --
> Sent by a computer through tubes
>
--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-05-31 17:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 6:23 Stephen Boyd
2018-05-31 17:00 ` Benson Leung [this message]
2018-06-04 7:45 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180531170024.GA56777@decatoncale.mtv.corp.google.com \
--to=bleung@google.com \
--cc=andy.shevchenko@gmail.com \
--cc=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=gwendal@chromium.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=swboyd@chromium.org \
--cc=vpalatin@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome