Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4317423ybc; Fri, 22 Nov 2019 00:31:08 -0800 (PST) X-Google-Smtp-Source: APXvYqx8QPmz7qtNOgzlCt7z+9tD6smHIUnjlXHc6D6KAygWEflrTTJn5s8QOybC7hU6xg37XKZi X-Received: by 2002:a05:600c:2550:: with SMTP id e16mr14767713wma.69.1574411468230; Fri, 22 Nov 2019 00:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574411468; cv=none; d=google.com; s=arc-20160816; b=Vsyki7SubJPa2hpeH6h7T3eiDS+bEsugKYiRMBo68IzuhNgdmAlB7w84qSHvA1eZj1 ZuPuFsP8XtgLBrUpuJpqTk/Gdzj69ESYn73nstxqIOW+eQJ9R+7NY8kBtWk7oDoKXo9H 7GFe58VfrPkGNefOS9FNqeMAUzj3Ob2E+YKq4PyPT5xRfsDOoCiIcFpi0UQldNdWODIx 0JU9bnDfH7oGWY1I7yVbwNSUsIGhjrezMLKR3Rs8UEmfSFLxsxC4vMny9ndyzyGYZ8NC +fENy9HJDaqUAyx1Jdw6Fc+ijPM4MUDMuYRNvf5DhJ4VRcpIozn28uxRFiJd4Ba075dP 8bxg== 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=jKBQdLAm2zPUHBSyTvHcFlnrVchOdAqJRuS0LhZZPbk=; b=dT592c/CMEDzuI1+OBkcQcZ8KVwyf0CwUVckDkXk8D7Bvl7I2o26hFzUppFShJS+8t Ls07s7DMy4Z9K4fawcftMqtCuERNh78FcBwIP19KipXkWuxVeGj/CNSJXPRkJ+HI08OZ zDFdAD7CHjJs3rRVu90cGn4Co4HVlMbg83hrMMcALk42cdE0o/IBNt5+o0o5UOqY5hPo yrBx5qaoznyIeYGmsceuacqYkOmOgQHqo9I2mTAIT6gbelvVobbSMjYlIk0doRdPWDqi jb7LZIp93sBoKMb8jyCk0ONozWTYJLtPf8rriVw3rYMerFVLcjiHgSX1qGnpkXFwsL3h clvQ== 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 i46si1081346eda.88.2019.11.22.00.30.44; Fri, 22 Nov 2019 00:31:08 -0800 (PST) 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 S1727088AbfKVI0p (ORCPT + 99 others); Fri, 22 Nov 2019 03:26:45 -0500 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:4485 "EHLO esa3.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbfKVI0m (ORCPT ); Fri, 22 Nov 2019 03:26:42 -0500 IronPort-SDR: nUKXrlh/pIQZ7db4cRbqISlRDADkhgjt0NBfcWs94CBz1s+Do6639qW5uwORufKLmXvOP58Jt1 SHV9gBrUtAdnkKDPvGXFlKxtPv0356hLzUKTVQ5I/6tIs/PtAqT+PXVVhsN9iaf7+lBSBNyOfL el96ThDw2fTC56NsYeGk2ANegplZrQT2l0GXoKMLdL3It/gBqApWqvBg7cfUcYPxn4+/3unYo+ kc/DAPkJe14z1KiC5lNYxOGRQolLcLPymmJhtZIrlnidHQ1Dlzz/y1KTVhn/DmI443MpUhmmjD wn8= X-IronPort-AV: E=Sophos;i="5.69,229,1571731200"; d="scan'208";a="43419513" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 22 Nov 2019 00:26:42 -0800 IronPort-SDR: EhT1w9diO6exW+ZYwZErq89l9cksFudE+O94WET14gCjsC2dNsgjgqr2NKiW1bnjoZwOYA2O8R dubRfX9BtVD9gfIhlXPJLUuyMQSX0uAPbRkbwgVzpIVOWb9nDo1jliFfvHFOb3O94mINyQ1FHW MCCDW14ZNUZF1rTFpmT9psFiX6U1Xylfatt7RPTs9rDBlRXblG5kOE6NcHs1pJfb+Nm2H+AlAR K2FtjQYqvwP0RYM2dYh2WZgTGj18N5dAcj0lAcpIsyrMEBBERhECgPzbk2wHW3mj//nH5J1kZV xgY= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v6 42/48] Input: Atmel: handle ReportID "0x00" while processing T5 messages Date: Fri, 22 Nov 2019 17:23:56 +0900 Message-ID: <20191122082402.18173-43-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191122082402.18173-1-jiada_wang@mentor.com> References: <20191122082402.18173-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 e3ed74e7c270..8d6478834fd8 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 @@ -1384,6 +1385,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; @@ -1454,6 +1460,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