Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp824680imm; Thu, 31 May 2018 10:01:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ/tz5H0hT/IKIdjRNEoKe65UAIiwaauYcfs+Uouy/0J6OADvYCPS5V1biQoTA5wYoi2vR6 X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr7957763pli.3.1527786082367; Thu, 31 May 2018 10:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527786082; cv=none; d=google.com; s=arc-20160816; b=vJX9lshR+LDQ0/QvaySFS3UNf2THeNQebwMrT6zknH6iDhGy6qTxtzpUtPeSmmiaWu 8EaDk6+SInSMJxx8SEklrn3L5AYB4maZYuFbmAEffWsPvNWgOaNdxsnV1WWSQbtleLuo tXMXexqjNiP7xHmc8qkrejyITgxFKE2nwVr0vT9ZprHEvgvyaq8SFrtn2qNdw2VFVY55 XiM+Y/v3LLwYW8MJIciyL3JL8gVM5aZD8ckbUcq2jH91VXnYSyuJgwtiXG7M0xAwMdL4 3R7mZsiDt5W3Xo49l4LnGv7dU3DzAr84IEjWFyBvLD76wL+hbBVDQtt9R9cm9/17tzlH hYZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=jKsEg1fvoPGwznys9xS4HDB1kd7EejdhfPxmt96mOpU=; b=vZTxl9EZL/F1Luwc6TcEOwfPER2CzEkL1hp+zup41dW445RwGHkC/wQPTntjF3S2Nf vVM1wpBFRq58mZVMy4NTELt30IeRaq3ZalD5+Ez2yw/4/bK6dpsgZ5XEyqunoe0e4ixd X0TnC1SRCOmfip5whSSm6fwTpOPXuQdfzzq2gEUK0EfTXETqJc3tM/YCBXYPkYMv8uH5 78SOYTIsnJViSRU11cueIpVQPpUUSJWrkJCPgaJMNfK7mV394+AtMT0IukmjuUlRm8IH vTe9bB2P0Wxm7MWUZYoJm+vNmtGyUvT0dzdRgUAsow+YT07qdn8pqQX2SCi2zO7Ci3MN RPLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pNXHA85z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f131-v6si36454870pfc.316.2018.05.31.10.01.08; Thu, 31 May 2018 10:01:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pNXHA85z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755718AbeEaRAb (ORCPT + 99 others); Thu, 31 May 2018 13:00:31 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:45124 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755556AbeEaRA2 (ORCPT ); Thu, 31 May 2018 13:00:28 -0400 Received: by mail-pl0-f65.google.com with SMTP id c23-v6so2285431plz.12 for ; Thu, 31 May 2018 10:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jKsEg1fvoPGwznys9xS4HDB1kd7EejdhfPxmt96mOpU=; b=pNXHA85zq8GFxKEFq3G70TmR6ZNQaHCdmbyNb+F9e2ir5TBfKELOspF44OY+SW+nBc V1ZOLwRxOH3xnuZJk+v0Rl+iqAZAIjboOoHekJcOoWAPR3HKIwXCIG7vi0xPosktqE82 tKZf9v6YqddzdfeHp0jtVNSwPbv5/tTH/y3SZeqhCbtoHWnpgM8NRkj4xlkIUgyjBtWa /pYERiZnJaeG5eAXL3FjzQqs6YUMTNq/iX8efKI3v3VE7mAdYBzt+Ihnpgg3y5zKzxdA ERkOHvX8ySqsnv84fWUYigfc+0QunthyWpqnhJRof9VRSINrxiEBtrI4Feavj8Y9cmsx XoOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jKsEg1fvoPGwznys9xS4HDB1kd7EejdhfPxmt96mOpU=; b=IRYEX3sNfqb6EEAp7nj4wzs0iBV7oudCxJcNFds6EBmelENJGtlIKrjtpb0qjgcfAy 1RzcrAvvyH+VM2+VSj4yMtJnBvS9201xje8KslwL4ecLSVfHroN3vj9Gcj7yX47CdIkf OuagSD8rQrk9iDkRPQbJ82CsspTGDePolbEN9gYUjO4N/DYn1Ip+WRZ10RObkZoYJiLN 2ktKEEbhy+gaECnk8Uvu3Zr9KnsXefpcvNYf0h/T/EEXQxUQypHjJVBGIa+JT5il0MeW HqZM7xvTQD7PtTiGVpgkq9U5TQdPZvQK5lJ5nE1Wu3XB0wGTkrG5+YhDcEu3MYPtjhNj 67Ag== X-Gm-Message-State: ALKqPwceS4bUbIeVaUDNbJ8OuhnXrYpRs8p4aYvt9BtdcWrx+e/5yF9H gbW+TdQ3yeNm7V/FNkZuNrxjoA== X-Received: by 2002:a17:902:530e:: with SMTP id b14-v6mr4404138pli.316.1527786027307; Thu, 31 May 2018 10:00:27 -0700 (PDT) Received: from decatoncale.mtv.corp.google.com ([2620:0:1000:1501:e4e8:e3c6:19f1:ae51]) by smtp.gmail.com with ESMTPSA id q62-v6sm100956589pfd.172.2018.05.31.10.00.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 10:00:25 -0700 (PDT) Date: Thu, 31 May 2018 10:00:24 -0700 From: Benson Leung To: Stephen Boyd Cc: Lee Jones , linux-kernel@vger.kernel.org, Benson Leung , Enric Balletbo i Serra , Gwendal Grignou , Andy Shevchenko , vpalatin@chromium.org Subject: Re: [PATCH] mfd: cros_ec_dev: Don't advertise junk features on failure Message-ID: <20180531170024.GA56777@decatoncale.mtv.corp.google.com> References: <20180531062343.243720-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline In-Reply-To: <20180531062343.243720-1-swboyd@chromium.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Fixes: e4244ebddae2 ("platform/chrome: Introduce a new function to check = EC features.") > Cc: Benson Leung > Cc: Enric Balletbo i Serra > Cc: Gwendal Grignou > Cc: Andy Shevchenko > Signed-off-by: Stephen Boyd Acked-by: Benson Leung > --- > drivers/mfd/cros_ec_dev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > 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_de= v *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)); > } > =20 > - memcpy(ec->features, msg->data, sizeof(ec->features)); > - > dev_dbg(ec->dev, "EC features %08x %08x\n", > ec->features[0], ec->features[1]); > =20 > --=20 > Sent by a computer through tubes >=20 --=20 Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org --/9DWx/yDrRhgMJTb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlsQKicACgkQHwn1ewov 5lhBRA/8CXu8Il4l9zXDDpvU8veNobp0ObupKapTz2F6G0str5COww4WUk953teN J9EYcEkpFA4UWzJPTw05/QYJJpasplE0EEHv2H9uJHD6P8aKAbJvyOLpbeFopjPR isozUI26MtFrJecdLhlBHF5XhKSoV6nrrl2zBrADWBg64/pqkYPq5SWjQez5+Z4r 07g8mwSfmfrXAQzw0I9v7y9olse/u/dKgBM1QqIZT9ZMh5SDhmDJMl4eiDRH3wll k1D5e7DTRUpGdde+3U93HpLFtJdCwWh7b0HYp07Bq7/RTDoSh7LnPdyF1JCWlyhp rS+u+BCm3cMzs+NTInUK4E88f4qQ6lu7ATke6nhnyEpYdH97cz8OJJGjRI8nsvCL Dkrxteb1jjZ2oFnZVAmMFORLO7q2EPJe79FSq+yoyC/S7PEzRsZQKnFUww2wu/Vd Vsxx/vNBlVJxY1XyBxaW8JjE9v6BjVCrQjZhiiI3Zjr1W+E9zuWZAJZtvJZI0UUF 877Ytm+UlSeTchy6JJnMb+zvqdIvmyzTVZ+4JGp42B7wDVblctneqgf6EBKpRQ+z 8WVmcbGAfRTmwyUVCccvvLl0+RNFTQMk25NspJ5TFbMdTymbBoVAlnAqiG+2u1qI hadjPNxqoXkeEBt55yMWTtVQ9aCynKWhyoB1dPMh4d9XYuKGwrM= =StVa -----END PGP SIGNATURE----- --/9DWx/yDrRhgMJTb--