From patchwork Sun Jan 6 18:17:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10749595 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 4E94414E5 for ; Sun, 6 Jan 2019 18:17:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33FF9288F8 for ; Sun, 6 Jan 2019 18:17:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2476828904; Sun, 6 Jan 2019 18:17:41 +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 C6A11288F8 for ; Sun, 6 Jan 2019 18:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726041AbfAFSRj (ORCPT ); Sun, 6 Jan 2019 13:17:39 -0500 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:60064 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfAFSRj (ORCPT ); Sun, 6 Jan 2019 13:17:39 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id BBAB4BC1 for ; Sun, 6 Jan 2019 18:17:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U7K-8Q_3RWMM for ; Sun, 6 Jan 2019 12:17:37 -0600 (CST) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 8F2B0BC0 for ; Sun, 6 Jan 2019 12:17:37 -0600 (CST) Received: by mail-it1-f198.google.com with SMTP id t143so5413982itc.9 for ; Sun, 06 Jan 2019 10:17:37 -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=R4rdnJmUl7RHx0SUd74LFc3h8YHD/OwyUQsNl0U59eI=; b=m58dfHPBEHibEnIk883CfTTIU0EF8Utsce+m3W65sQvpHtFCScIx9emI1bMaiG/bXS B34aWt6ngEkC2GInpgQb8yzWaozacAFxhOy5NhUS4D8ZN2ulV7s9PkBu+3ctHv1ed67J wF+p7wEMQ/tnVmrqw4eZCsIepstnNsBnlTOypoguicwoZX+4ZzPq3YPYhm5Cp4KFN5vt O1oUpLVGdcD+rTEU4F7E3Y3uMseXI5VtJs3ijJKWBkdQGfxc2ZqzOM8z/1N3SDDqTs6t yf5SoVtmGbDOC8IYWCVwW2yXlt5fm7OCzIXB7F2Jt7L94cDuimcSrgTIOL+eI2ADPFk5 THQg== 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=R4rdnJmUl7RHx0SUd74LFc3h8YHD/OwyUQsNl0U59eI=; b=t+r4pJCyP7WtlOtaXVbVLA/32uYzhIV0aCudrtWYoY6xv6POQWnwVwWzAlILyv9VLu M4+tzGVuL1LW7UWalM7bCQiFGGMx9C0HzoDYCiLhhzqYBztj5HNDspWxAT6PuKhSmTeM 3OMb6H/M7d91/HYJopa5t4aJCe8Pd5Q1O3nP8kn+gXB/4thQJjAflu1SzRqmIuFPFlc2 gBVVtC+QPGwT4/bN4HTjB2Z/j5KGj4NeUncOcq1I0zHCoVVet5onluWUVNeWDe8MxyYr 4kRx1KSUfzD4ml5XF/TONrk7G3sj/WRACmve0P5Q82JvX5abDYx/sipPgclJqgDnKpnm XEFA== X-Gm-Message-State: AJcUukfmoHKrwE1GD2+fQgTCYjYuGOOSj3+rdqCPoHohpyP11OUh8ewe +KabO+NO0M52C0/ZcgxUUJJ/k56qaGIONjVz/0E7K4Z4LxovMjKkNCUCg5rkvBA31p5uPNQOE8v hQEWNyNTPSAVRWFqA5ouqveqbHNY= X-Received: by 2002:a24:7a94:: with SMTP id a142mr4486760itc.88.1546798657209; Sun, 06 Jan 2019 10:17:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rivm7cD2r6oyKrhC0cf6ZTjJ49PdGTA0B0ZoRD4UZQDvgzNhc3n7MJSSN7xKShvlAOCODIQ== X-Received: by 2002:a24:7a94:: with SMTP id a142mr4486756itc.88.1546798656979; Sun, 06 Jan 2019 10:17:36 -0800 (PST) Received: from cs-u-syssec1.cs.umn.edu (cs-u-syssec1.cs.umn.edu. [134.84.121.78]) by smtp.gmail.com with ESMTPSA id y5sm3451972itb.42.2019.01.06.10.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Jan 2019 10:17:36 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Michael Hennerich , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] Input: touchscreen: Fix a missing check on regmap_bulk_read Date: Sun, 6 Jan 2019 12:17:27 -0600 Message-Id: <20190106181727.11815-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 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 regmap_bulk_read() can return a non zero value on failure. The fix checks if the function call succeeded before calling mod_timer. The issue was identified by a static analysis tool. Signed-off-by: Aditya Pakki --- drivers/input/touchscreen/ad7879.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 6fa714c587b4..8c908572c1f2 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -246,11 +246,14 @@ static void ad7879_timer(struct timer_list *t) static irqreturn_t ad7879_irq(int irq, void *handle) { struct ad7879 *ts = handle; + int error; - regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS, - ts->conversion_data, AD7879_NR_SENSE); - - if (!ad7879_report(ts)) + error = regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS, + ts->conversion_data, AD7879_NR_SENSE); + if (error) + dev_err_ratelimited(ts->dev, "failed to read %#02x: %d\n", + AD7879_REG_XPLUS, error); + else if (!ad7879_report(ts)) mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT); return IRQ_HANDLED;