Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp752447ybg; Thu, 19 Mar 2020 08:09:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsGVWhmjVFkQ7XwPjZAfYpMAcMs37t4QEpxd86+Y/8zALcGaM4raNdSFVDqvpM8Gz27kpaE X-Received: by 2002:a9d:30c7:: with SMTP id r7mr2624150otg.289.1584630570273; Thu, 19 Mar 2020 08:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584630570; cv=none; d=google.com; s=arc-20160816; b=pR5rVYA2EZUoOXoTpLdzlnDJQT7oLkPLPUjAOTij0oTDpYYTpsw2n2mxuGmEMC+WcY sUjoCyyldbjBA19CTLFiaGYXGHg5aSKlhT+L3ksd7RajK3mn0s0k5hmEZL0qBPtLk1Uf LzxMnTeNSb9F53+WGfY9sIexP+EK+qenBwwyxmV27kjaiaO/pe4MmRSoAsFrK/4f+bUF kOq0VVswGDhb3fNhXU3Nah0s0kSSqqY7NtwyASOAhBVgVMCqWNgV2Yb+OvhW/NlNcjTt 3DN/zBL+xn587ZTUEpNzzQGMwytE0bSN0B3E1Eqmc2jwbLt2HJY82/PS4zGJQdkD9DSZ vE5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=GFNTvAO14xTLSxF4+Np39eC0sxwQ+slIQ1cGp1aip8g=; b=pauXcZ29K1CrhbT0sbiORftKmYKDTWTAUF/+NcIsbMT0jmXxgNzzG52YV6rZpSK7K5 2/p8FS2jo49VexZlSfKLS+K8UTD7LyQ4N9e5QKO+Xjt8n65TN+piOo5mrlpynsQTr3Em 1mHSZ73qZDCb8BnPCnTXdd0gsBRWeeax5dcUS1D/E52q/b/8F6WGjmLgbLCVB5zlcoZh jVc2IjT3MZP2mCzA1HwGOL0DE2PzrqYN7nAj2s0BOEIbyttKg9O+F/XRVEbhwwKNtcNb osu05y9fh7bk5B7ufNq3oRUHvcvG0LkeEnYoDw/q2W9+v5QkvkYDl4Sz+Fhr4w3ASF7r wBYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si1350246otn.302.2020.03.19.08.09.03; Thu, 19 Mar 2020 08:09:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727887AbgCSPG1 (ORCPT + 99 others); Thu, 19 Mar 2020 11:06:27 -0400 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:5803 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727858AbgCSPG1 (ORCPT ); Thu, 19 Mar 2020 11:06:27 -0400 IronPort-SDR: dyBhasTIP4xAvkPQjy4XzWktdg0cjcjW/uXVrM6WgRmIZJ7ebsxKSSIN9V6y6kEaZVfxore488 NFgKFDnFR/iWWjBczAgSmkagFnc9XU7Rfy9NEuzDK8Tkh7zGLw/Bw776b7JD8TbPrre0rU+C8P DR4STE0EQG17A1YyY7crbhUGLeIiBiSCIMaKs7fOnMbVAp8FPTLeNqmUT9VP6poICfrGB8BKcw Dbv4LmY6i2bkV966PFnQyAJuGDrRXtfVAYmcnWdwMsT9lkyb5/fVC7XPyrDEvteMrXQPEgIR0k xpg= X-IronPort-AV: E=Sophos;i="5.70,572,1574150400"; d="scan'208";a="46927060" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 19 Mar 2020 07:03:22 -0800 IronPort-SDR: zaOb566Jh7wRAf/JNK7/8EMUwTtcK+da1BnPD+80152hVdLeVfxLObvn4+dK1EzA+GYQM4aUH3 d6R9vGtF4tuWrf1NbIEQZ6KRLo2gMh2sF3OD95Aw+53XP08p8+SmrbPK1GiVao9quqvcMCyAdx Pon1Ml+KYwHstuqkQZdNXw5HjBqTjLs1odB7N8fUxaZMAacuD76RIj9A7e6uP5E5lYFtIiRaTX QMlzad6znJtuHHg8EQCBVc3DAZlJE8vkBRvSdw9iicl3xfoz7uHdTYPxSEa3PGLPoWfdJL3l/9 vws= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v8 46/52] Input: Atmel: handle ReportID "0x00" while processing T5 messages Date: Thu, 19 Mar 2020 08:00:10 -0700 Message-ID: <20200319150016.61398-47-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319150016.61398-1-jiada_wang@mentor.com> References: <20200319150016.61398-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Deepak Das ReportID "0x00" is reserved by Atmel and should not be used by any Atmel touch controller. reportID is the first byte retrieved from T5 message payload. Currently Atmel driver continues to process the T5 messages even if the reportID "0x00" is returned by Touch Controller. This commit modifies Atmel touch driver to return -EINVAL if ReportID "0x00" is received while processing T5 messages. Signed-off-by: Deepak Das Signed-off-by: George G. Davis Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 994232c43554..6b4809903ee8 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -76,6 +76,7 @@ #define MXT_PROCI_TOUCHSEQUENCELOGGER 93 #define MXT_TOUCH_MULTITOUCHSCREEN_T100 100 #define MXT_PROCI_ACTIVESTYLUS_T107 107 +#define MXT_RPTID_RESERVED 0 /* MXT_GEN_MESSAGE_T5 object */ #define MXT_RPTID_NOMSG 0xff @@ -1381,6 +1382,11 @@ static int mxt_proc_message(struct mxt_data *data, u8 *message) u8 report_id = message[0]; bool dump = data->debug_enabled; + if (report_id == MXT_RPTID_RESERVED) { + dev_err(&data->client->dev, + "Received Reserved ReportID 0x00\n"); + return -EINVAL; + } if (report_id == MXT_RPTID_NOMSG) return 0; @@ -1451,6 +1457,8 @@ static int mxt_read_and_process_messages(struct mxt_data *data, u8 count) ret = mxt_proc_message(data, data->msg_buf + data->T5_msg_size * i); + if (ret < 0) + return ret; if (ret == 1) num_valid++; } -- 2.17.1