From patchwork Fri Dec 21 06:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10739981 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 AF4A114DE for ; Fri, 21 Dec 2018 07:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E6712868D for ; Fri, 21 Dec 2018 07:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EB96286EE; Fri, 21 Dec 2018 07:13:51 +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 207C82868D for ; Fri, 21 Dec 2018 07:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730497AbeLUHNu (ORCPT ); Fri, 21 Dec 2018 02:13:50 -0500 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:55838 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbeLUHNu (ORCPT ); Fri, 21 Dec 2018 02:13:50 -0500 X-Greylist: delayed 563 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Dec 2018 02:13:49 EST Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 45C25CF9 for ; Fri, 21 Dec 2018 07:04:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fdvdid1kZOJI for ; Fri, 21 Dec 2018 01:04:26 -0600 (CST) Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 0A14DCB1 for ; Fri, 21 Dec 2018 01:04:26 -0600 (CST) Received: by mail-io1-f71.google.com with SMTP id c10so372834iot.9 for ; Thu, 20 Dec 2018 23:04:26 -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=v/dFnFU7Shmd0+bhBNKw4Rcta7xP+/MJf4OJ1gDaB6M=; b=n9ewZN0sh/905HqzRqq8wV+n+JCGS7KX0kBqO8qQqCrOV70sQq1KO6BjZc6ot04Izs RRBX7PK0lFq6nGmZ3NPpG0C35ekUqKH++V8b4ArK7A2tq0iDyhJ7M4PNSttQ2Puf95ot jM1ude7MEz3isr8cSGAK7MIs7BKuLYg068iwhQYpcMAE3UFzZd8mZENLxLAIfbF6ASMt 14fYWVeKem1sbsnjY+YjPV5rORKviUu5Vy3qxF1SwfsCoVNOBaKUMQ2ZnQmUL7k0jE2s R+hCadzAfd6ZRWF8wvVSFpxunYryN+0ydWDYgKLSaamouiwkD44gEj3uE7S3jLVL/a7h lOnQ== 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=v/dFnFU7Shmd0+bhBNKw4Rcta7xP+/MJf4OJ1gDaB6M=; b=b68rTNV5pf7DjkZ7KxifGFM9YaDfiyQ7Xs2hQjOGL3/sIdfZyF/TPzVAnsvrty2rbV wkIZWsHhMx7q76h065LjxFIRINbDj1p8qktokJmXfkYDLoeFuMjQ9bp3KRw8aQ+ma+6L I2/4bWpFccwdJNTu7HpBnrZKVdkiX7CY4mIRiLLJhq2YOGC6B2eHfq7bTjeHGHSoyaja h4Bo7hFCXe6qxVSYuYnh2JxSecjbWjL424tEKek+52dkSvnFMbrtiTjTae0evaf6otai N2vdh5156HwKxTQlxLfR1HJYpIKYC+FrIWphSAvdTMTDxBDYK7+v2bPrnwoTlgDCEbu+ bgZA== X-Gm-Message-State: AJcUukdXefBrhiQWVb2I0J9bnX9Z2yMd6kr1HVLf1oUFx8zMfU/6t37h Rm3WMrF5W5OM996jTnyQtFT3Emp94rQiQJJfYFxO/tCrqhxxmqtIjdqbLCCUQvOW9/jEGGYuR9a wtKCBrPp+be0kmiGHUOtNkOptWF4= X-Received: by 2002:a6b:ab83:: with SMTP id u125mr828030ioe.211.1545375865617; Thu, 20 Dec 2018 23:04:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4d8SsIYXwsiYoNHTIaSE14oqxMhJJX9Dcg8lQx8VaJCXUmOB/hwpyX9kpVCcPyHAUuKFlU/g== X-Received: by 2002:a6b:ab83:: with SMTP id u125mr828022ioe.211.1545375865378; Thu, 20 Dec 2018 23:04:25 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-23.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.23]) by smtp.gmail.com with ESMTPSA id 79sm7654383itx.11.2018.12.20.23.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Dec 2018 23:04:24 -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] touchscreen: elants: fix a missing check of return values Date: Fri, 21 Dec 2018 00:59:16 -0600 Message-Id: <20181221065919.60129-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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index f2cb23121833..cb3c1470bb68 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -245,8 +245,14 @@ 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)); + error |= elants_i2c_send(client, rek, sizeof(rek)); + if (error) { + dev_err(&client->dev, + "error in sending I2C messages for calibration: %d\n", + error); + return error; + } enable_irq(client->irq);