Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3367318ybb; Tue, 31 Mar 2020 03:56:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsCtDEktynMu76PEzLak0JOkDq8jIUd+O1Licp+b2lUvQKkTrkjUh5GcnloJr0aNYRiM9yu X-Received: by 2002:aca:cd58:: with SMTP id d85mr1620941oig.173.1585652163759; Tue, 31 Mar 2020 03:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585652163; cv=none; d=google.com; s=arc-20160816; b=KcvrhMl9wOO+Qa8L9A/mAdk5ToQPDC3ZHJyNbKy3tG2VdKnVv4VBoSTuBTCLlNm7pU HIhhDQ3G/kdYkGKEQkV6OFhOQyKpxXfwx135/fSk8+yvecEtOQa/eKzaN5kAm8M5XNFn hOFjN9rZvMWQcCTJ2awtL5xdrjIwQfgUsvbmt9zSu0DsbL6k6Z7FRQdS1AiNG/HuDhUO jAK6LRm7hXYZ6WnAENNzNr626p2xfLZHc+QlThI9WEOqD7TnTHwdHLXrgp0K/55DnW3Y p9cwkx6SQqi11eHw4dePWhZ5lITUfmwfdtjsDpJv2ZQ+fB2vI16ttn8wbmnewg1JS389 T1TA== 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=KlI1lLglut8w8Tf0FYPiER2mrWYalzGueuTP5eMK3RU=; b=RQOnApr4LqgUt5q70cZqUurnwpI3o/Tw3IMh15nrC/NxpaBb79h/+j0Y3Rw/PUAHyD 1VQZRlPV9jzOW3vH3M6H8IXBpaBpxyi5eFb0KwaSYR5tiIhLXJF+LGMit6GkeSGuU7p0 HXg0Aa/+yCf4p6eaFjMKpsmptT11y+SqGvpZHSUPf0aDJfRGfVcaxBkPo0PlOrgfmlbm rdCBgMMI1DbObwZpu8GzMTw3qKRH6evoZyeKDqNZXO2B9s0zFm54cH2oxbje5LKmMkNu lEmFojzfoNQm+C7CQH7Mf7f3VQqy0isucgqb8V+osDcBge+lMOzPjKZVUHcGIWIsRKKg qCIw== 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 26si6932726oiz.107.2020.03.31.03.55.52; Tue, 31 Mar 2020 03:56:03 -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 S1731015AbgCaKyD (ORCPT + 99 others); Tue, 31 Mar 2020 06:54:03 -0400 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:43597 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731003AbgCaKyB (ORCPT ); Tue, 31 Mar 2020 06:54:01 -0400 IronPort-SDR: LfYK4xXidlKhgWxwGVYhbfep5kZnennVjBl3ds599EZUOJCCrf0fNItbyEuwmao4Xji0D0WbGg d/EBeIbaGDY75CmBOS9wsX0915GiCNSrOq/GTotjM0YYEcLvV4kadApp3S6HMjcnOQmMZ7u5m+ jlubRW1FFe4D7U2DT1WlPfN8dy0WNLINxUwqOv2mPrCVr6nr6uw46P64F2vujPkk0KfI5LCLxo GthR4+R/w/5BonaPdje5j1IaS4laxMWc+Ah8wl3Dpriv3XbRoQ0wnGlAeQoaH6wQGRv4XIek+y fqA= X-IronPort-AV: E=Sophos;i="5.72,327,1580803200"; d="scan'208";a="47330849" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 31 Mar 2020 02:54:01 -0800 IronPort-SDR: fIo6CUoCqI+lV6D2t1nx4/2oUiJ8JKYojbFpAkU+lPjYaFzWEUfG4ecyY4AaTi4ConJUNnCf7t EyAoC3oI1Pm7SrVVVQ7Nnxxv8OqakFjn49z9WRLznL1ivmjiBhteDyzYczlHGEr/5ZsqMjdFSV 2EWCvfca8XU3N05zQ1ND7GdaM0xsbZg+Tc5p6Gk/MeT8LYpI6L5Kn9Ez8COnKuWVFbcUDagf40 LiHMqpb/VbBbbyEbhNSvBYIIMtgIoqP9ZCfEsocQr9NvjvhQoV/6BKWB5eWxfa9+u0AyEvIItH iyI= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v10 49/55] Input: Atmel: handle ReportID "0x00" while processing T5 messages Date: Tue, 31 Mar 2020 03:50:45 -0700 Message-ID: <20200331105051.58896-50-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331105051.58896-1-jiada_wang@mentor.com> References: <20200331105051.58896-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 ed357e958f07..496b1f67d9a5 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