From patchwork Mon Jul 25 18:14:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9246307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B72C60869 for ; Mon, 25 Jul 2016 18:14:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5235926538 for ; Mon, 25 Jul 2016 18:14:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 469752705B; Mon, 25 Jul 2016 18:14:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D080926E5D for ; Mon, 25 Jul 2016 18:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423AbcGYSOa (ORCPT ); Mon, 25 Jul 2016 14:14:30 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32847 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753158AbcGYSO2 (ORCPT ); Mon, 25 Jul 2016 14:14:28 -0400 Received: by mail-pa0-f49.google.com with SMTP id ks6so63637485pab.0 for ; Mon, 25 Jul 2016 11:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=51GarVnpfG1SvBh8na+GsuSq5PfcYYR2Xn7LamPuMq0=; b=gA+u4HNUzij/HvKTKneioivA706tMtbwHTcByTk60vqA3Qq9HNti1XRMhYC+KQbPMc Hv+gxeY/RFr4T2YqeKFw8TQfxMAAT2ESsWQnU04HBni2m/mx+YGzTDqpsElUB91W0zHY 0feX2k+Bq8O3EOwSicatD2FmvO2y5RzPZ9FU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=51GarVnpfG1SvBh8na+GsuSq5PfcYYR2Xn7LamPuMq0=; b=G+TxVqK5Lv/IKOeMUQNbqtHJDcw/DU8/EeNxcy1OhnnVNa0k7PwYk+m0BvSdWeSn9B 4YYiPZLgOTJjW5kEu9Ofybi4gh+IfZ+/phplfy929sr9dRRqbbKyS6p2/kkbqrTjnb77 pZZh6xgV5zAVOLff/GNhn3VOgpAQk4C8eRFw6HZpejGm88mlATLFQ3/+RMoUL2yiPjni GD3MF2mQqM2ypEKm8Q+3+6Nzg7cqpGpzM4/8ujDBuoGilG591tZTh9l9wWHD99irmjiy XsR+4J4zAZ/O9nPJdeFqTfUYRgz0MPjLYkk7w7Q3YxsaI8DKJQFZ/vhOLJgZa87BbXqM ToYQ== X-Gm-Message-State: AEkoout945gtYXjdrFUkCJXB2Oxv62CHxelx1MaF0/Dw1H6ylAYV7dWOxtElZ6EamBh+T2Bk X-Received: by 10.66.74.103 with SMTP id s7mr31429805pav.1.1469470467736; Mon, 25 Jul 2016 11:14:27 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id 75sm41796568pfw.92.2016.07.25.11.14.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jul 2016 11:14:27 -0700 (PDT) From: Brian Norris To: Lee Jones , Thierry Reding , Wolfram Sang , Dmitry Torokhov Cc: Olof Johansson , Brian Norris , Javier Martinez Canillas , Enric Balletbo , Shawn Nematbakhsh , Gwendal Grignou , Tomeu Vizoso , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Guenter Roeck , Brian Norris Subject: [PATCH 2/2] Input: cros_ec_keyb - Fix usage of cros_ec_cmd_xfer() Date: Mon, 25 Jul 2016 11:14:11 -0700 Message-Id: <1469470451-111822-3-git-send-email-briannorris@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1469470451-111822-1-git-send-email-briannorris@chromium.org> References: <1469470451-111822-1-git-send-email-briannorris@chromium.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Brian Norris Acked-by: Dmitry Torokhov Reviewed-by: Javier Martinez Canillas --- 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;