From patchwork Tue Dec 25 04:36:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10742531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AA451399 for ; Tue, 25 Dec 2018 04:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85EC828712 for ; Tue, 25 Dec 2018 04:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7685A28B62; Tue, 25 Dec 2018 04:36:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 7038228712 for ; Tue, 25 Dec 2018 04:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725862AbeLYEgp (ORCPT ); Mon, 24 Dec 2018 23:36:45 -0500 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:39358 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbeLYEgp (ORCPT ); Mon, 24 Dec 2018 23:36:45 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id B03F5B92 for ; Tue, 25 Dec 2018 04:36:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v2-hKI4ynRaU for ; Mon, 24 Dec 2018 22:36:43 -0600 (CST) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id 817C995D for ; Mon, 24 Dec 2018 22:36:43 -0600 (CST) Received: by mail-io1-f70.google.com with SMTP id t133so15261144iof.20 for ; Mon, 24 Dec 2018 20:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=MOuqoXvDQR6WaOPGYewfFnRK6hqDn95BYOfHQWaJgjA=; b=Mafaqh8rSfeMEvhmZ/IyTFBmtjLSOWs9fSla/mTQlhJsjkCbCXFHXu0FM1u66PvTyq yXkh8OspUzkFn9/te1r91ZOq27oFBuEcKOM+ieMUFqKt3z6Fzc2Y8q+QjdcjD9jsxZ32 H0RVccsosCevxPYeGplyxcDSPgfEFFfbZFBlBagxvcJUsAwoyDmylsc9/F7qmQwP0/cI 372F4TtcdpUJlCCBznJOZVWyuSTChWcbvzKwZSsNq9eTo2assBcK+5UxpTHDnsyzj1IT K0TkqgNwxTbj36cGFp045OiG79/n5hOqbL5ec71dV9RSAVI4Qsedk0AWrM+vXG8BtR8C FZZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MOuqoXvDQR6WaOPGYewfFnRK6hqDn95BYOfHQWaJgjA=; b=lZrZt9SpVtniQnZo6qxB5ozrGE2ztuZvvXYPnvmw13ZfiuFKwcdUfdHbZXaVx7s+3Z P901cJ1b6bUF74fmbcSkdTk+FGDCfYTLfLdUImne2h5c3VfhO7GThbGcuUcT0cePuxp3 cSa6IonBUfPh74HxWiJXY37V/72libyRv0NAeyT3Yj7FIrBnAExoMd/Tzxxb7mDVPrpP LIYPPrV4vXmryTbxJ1A/RHYP18UUYHTdDphOyDSfwEr0kVE1HTkdtCKRvdqy7KG7saUu Jop54UUylxqIJS7craaXiNxlri5+sp/AK8zTGF8atb/1nSHDhqTWVlLOCvzuxxhEJven kMFA== X-Gm-Message-State: AA+aEWahw7O2v2St4NKYQaqoEgez3QZMmDv2NU5daI+BPI4oNL2WgVJR TTWmCfH7wsSY7QKiHvnmevnT0JICsAl3V+KrXf2ZJzOKnaGkxiD8Sa3CSrqjQoxK4juYIgoJK+y K352v1OmErkRmQow1fO9gM5igJJM= X-Received: by 2002:a24:9144:: with SMTP id i65mr10706096ite.115.1545712603143; Mon, 24 Dec 2018 20:36:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ot7t3KNA2d43rlVfJCBsoawY68ASyDlAkmtWczhvWi8utQx8ZiYXJshYcx9UpiNmWZmlu+Q== X-Received: by 2002:a24:9144:: with SMTP id i65mr10706086ite.115.1545712602820; Mon, 24 Dec 2018 20:36:42 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-22.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.22]) by smtp.gmail.com with ESMTPSA id d9sm5349192iom.72.2018.12.24.20.36.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 20:36:41 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Dmitry Torokhov , Greg Kroah-Hartman , Stephen Boyd , Joe Perches , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] touchscreen: elants: fix a missing check of return values Date: Mon, 24 Dec 2018 22:36:13 -0600 Message-Id: <20181225043616.66032-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) 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 elants_i2c_send() may fail, let's check its return values. The fix does the check and reports an error message upon the failure. Signed-off-by: Kangjie Lu --- drivers/input/touchscreen/elants_i2c.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index f2cb23121833..8ccba4ccee37 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -245,8 +245,22 @@ static int elants_i2c_calibrate(struct elants_data *ts) ts->state = ELAN_WAIT_RECALIBRATION; reinit_completion(&ts->cmd_done); - elants_i2c_send(client, w_flashkey, sizeof(w_flashkey)); - elants_i2c_send(client, rek, sizeof(rek)); + error = elants_i2c_send(client, w_flashkey, sizeof(w_flashkey)); + if (error) { + dev_err(&client->dev, + "error in sending the w_flashkey command for calibration: %d\n", + error); + enable_irq(client->irq); + return error; + } + error = elants_i2c_send(client, rek, sizeof(rek)); + if (error) { + dev_err(&client->dev, + "error in sending the rek command for calibration: %d\n", + error); + enable_irq(client->irq); + return error; + } enable_irq(client->irq);