linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>
Cc: Lee Jones <lee.jones@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Olof Johansson <olof@lixom.net>,
	Brian Norris <computersforpeace@gmail.com>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Enric Balletbo <enric.balletbo@collabora.co.uk>,
	Shawn Nematbakhsh <shawnn@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
	Brian Norris <briannorris@chromium.org>,
	"# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper" <stable@vger.kernel.org>
Subject: [RESEND PATCH 2/2] Input: cros_ec_keyb - Fix usage of cros_ec_cmd_xfer()
Date: Wed, 10 Aug 2016 13:37:19 -0700	[thread overview]
Message-ID: <1470861439-129201-3-git-send-email-briannorris@chromium.org> (raw)
In-Reply-To: <1470861439-129201-1-git-send-email-briannorris@chromium.org>

cros_ec_cmd_xfer returns success status if the command transport
completes successfully, but the execution result is incorrectly ignored.
In many cases, the execution result is assumed to be successful, leading
to ignored errors and operating on uninitialized data.

We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
problems. Let's use it.

[Regarding the 'Fixes' tag; there is significant refactoring since the driver's
introduction, but the underlying logical error exists throughout I believe]

Fixes: 6af6dc2d2aa6 ("input: Add ChromeOS EC keyboard driver")
Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/cros_ec_keyb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index b01966dc7eb3..6e48616a3a88 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -160,7 +160,7 @@ static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state)
 	msg->insize = ckdev->cols;
 	msg->outsize = 0;
 
-	ret = cros_ec_cmd_xfer(ckdev->ec, msg);
+	ret = cros_ec_cmd_xfer_status(ckdev->ec, msg);
 	if (ret < 0) {
 		dev_err(ckdev->dev, "Error transferring EC message %d\n", ret);
 		goto exit;
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-08-10 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 20:37 [RESEND PATCH 0/2] cros_ec: utilize cros_ec_cmd_xfer_status() Brian Norris
2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
2016-08-10 21:15   ` Guenter Roeck
2016-08-14 22:24   ` Wolfram Sang
2016-08-10 20:37 ` Brian Norris [this message]
2016-08-10 21:16   ` [RESEND PATCH 2/2] Input: cros_ec_keyb - " Guenter Roeck

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=1470861439-129201-3-git-send-email-briannorris@chromium.org \
    --to=briannorris@chromium.org \
    --cc=computersforpeace@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=enric.balletbo@collabora.co.uk \
    --cc=gwendal@chromium.org \
    --cc=javier@osg.samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=olof@lixom.net \
    --cc=shawnn@chromium.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tomeu.vizoso@collabora.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).