Received: by 10.213.65.68 with SMTP id h4csp2149767imn; Sun, 8 Apr 2018 21:00:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48A4SNv0Tgk4mZTYk/R8YFhEwMR8SFh6C18p3yokZzlhxdOW4D6SYIsFXYj/w4d79gMs3Rb X-Received: by 2002:a17:902:7201:: with SMTP id ba1-v6mr116164plb.283.1523246445139; Sun, 08 Apr 2018 21:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246445; cv=none; d=google.com; s=arc-20160816; b=OXJQMjSwEqeEX8pxxTxtCoExQ9UbMPO9syI/ea34eUREMPAT0PI/OdHgXeMzWVyk22 1GOkOPuuVNGMZCaVjL6YsTtK9bfSV3l75kO9qAKJgUrtJ2fhCvxiTGOMDF4d4AQZwuUy 6sNaUa/SH+jA3WXZ/7EH/ViaKqLu2F5WeLWy+BDMnv6zGnG6P3bbEfZAYsvZC/0YmNR6 EMoB/mh+fGdd7CJe7pjKFrGJPAgJiNY1y3/ZWtaFjvd6RPir5d5oqhkl2PBtbnc6IToI JVy2r6aBcPR0j/3Ew20b+KYosraD2caTSccwl5qHNiBLdInERzUJpHRj4Xhid1Ob8QfY n2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SDGiEXPASlq2LoAtHicbNog/9F4BxOwuME3v7gfF5I8=; b=bwJksZ+7FsxaVNHb9SV/dx2xje7NUYEehIy1Ol07zGiLTyxIq1bCql3pIRnXNCu+sL SvahYJonGc/9PcH0ZFvzG4VhmnMdXcv85UGFzP73IsNixzdZKIhKQFO60c65ApUSqCII uuWoZlQLzgrQ7w5edQ6Qu3e5CN31c9D7RCHjT/V6LfW2p2DNPY8afTTbNxdxerC2bOEW TfwRYds+fuAWTGOXaegO1wqyl0E/y9bnPENx66WlBQWXLMHld+Af1NjKFWJ7ktuTy/yk 9oWa/Sm4iseVDO1QAJOgKtKHSdlx6F29Mr4S9FI0n1bDRFksDHVqsUHvoQ+rqVOg3s6s q60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NZJW68KI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si8366506pgn.36.2018.04.08.21.00.07; Sun, 08 Apr 2018 21:00:45 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NZJW68KI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187AbeDIDzc (ORCPT + 99 others); Sun, 8 Apr 2018 23:55:32 -0400 Received: from mail-by2nam01on0126.outbound.protection.outlook.com ([104.47.34.126]:59343 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753815AbeDIASv (ORCPT ); Sun, 8 Apr 2018 20:18:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SDGiEXPASlq2LoAtHicbNog/9F4BxOwuME3v7gfF5I8=; b=NZJW68KIiMcO8EbqU480zn3tD4lLMcO1GAAAoLJZ1QriQsm+RxkK3R3Ov8FM/AhzJqj1fFrop59TLsuCDf7fFbMVtAzHjtjMY9d540yerJYBXOtvzhbwwd+ChAmemZzTlic2ECu0nk5/sIHqCX9eEAY2QybhdMsk7dlvOu96JPg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:18:43 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:18:43 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dmitry Torokhov , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 089/189] Input: edt-ft5x06 - fix error handling for factory mode on non-M06 Thread-Topic: [PATCH AUTOSEL for 4.15 089/189] Input: edt-ft5x06 - fix error handling for factory mode on non-M06 Thread-Index: AQHTz5g1ZC1cOALDcECbXaqdIJXLeA== Date: Mon, 9 Apr 2018 00:17:55 +0000 Message-ID: <20180409001637.162453-89-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1128;7:gGU6jAWbdJcFMHU4Tty+oR129X2YCgfSx3QqvLTEHQKd9+RwhQU3A0TG7EJjRqh8w7tXkcF05TfXGJ6tZy2R+N+8BBlYpcDtwn53zFI/FC44iVCLGnOUH5s5U7U5OTmrFvyi2D+y1xau9oPZPRCfRGezk8+spfNLzSvv3kWh/8QwwGXTGnrCxlKM1/i946UluVLvp4BB0vUOCMhz36is1QyLo5nTE5pskyzltIEwS4uc2d4e7Su1hv4744Jb/4SQ;20:eVlkGJleFcIWj0ebiMePYCb+OFDjATmPf58iEYNOSS6F/vQicenN+jVldHGW67zFpYF/FdDGHTNX2afrQPyvgNsu4IWTF55eQZbQzGhe7ZSbxsmzd/uP0VkRP9ak2l5dFUzlZSbeaStEmn005VS++RKc0rcEaq7fsRYSt8oBYm4= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 14c2c5f8-2727-4523-7589-08d59daf73cb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1128; x-ms-traffictypediagnostic: DM5PR2101MB1128: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1128;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1128; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(396003)(376002)(366004)(39380400002)(199004)(189003)(66066001)(86362001)(59450400001)(3660700001)(3280700002)(2900100001)(25786009)(36756003)(6506007)(76176011)(2906002)(6486002)(86612001)(99286004)(102836004)(1076002)(7736002)(575784001)(97736004)(2616005)(446003)(486006)(11346002)(476003)(26005)(305945005)(39060400002)(6666003)(6512007)(4326008)(107886003)(478600001)(6436002)(5660300001)(10290500003)(5250100002)(22452003)(316002)(105586002)(186003)(8676002)(110136005)(54906003)(72206003)(53936002)(2501003)(68736007)(14454004)(6116002)(8936002)(3846002)(81156014)(10090500001)(106356001)(81166006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1128;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vcKXwPLhEOAJaDdcdYeC2nKZW4ppOieBUJ2umkpiSWLhpS7aazjV7NRwr4868fjpiS1bMsopGCZJqtK8caVF5FImWhO/ITSlDUmeNKQeM+k6S90xMSjr9yaDly0FabXygPswuGDbU6BTgM6LGmQiJVKhhhKCc2fnbZqWWkU0AWqXVOTiaOZruK8sJwlsg1vB7RHLxGGE6u1c6HHEowi6NhjZg8LI0p9kud1kMLDs3qMI3frwyP7mwTnSRDhCOzvoHxHnbK7iD9rfHzpYCCWsWZwS2Gn/wGbpDRwkBWDIbxuzyQVF/py7VFqkEArhfbT0hIrYkfZJhIfvAWShbgSBK7wQ5BplWBt4aWe4uELF1x+kVwYXhVi6EJpb4FwPRlqr7jfYWV8KcZYTHwNkWInG9mGMWcy/Lmbfb74U5RTF1FY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14c2c5f8-2727-4523-7589-08d59daf73cb X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:55.7260 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1128 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Torokhov [ Upstream commit 4b3e910d7f430ab76dd37131bb75129878950163 ] When attempting enter factory mode on firmware that does not support it, we'd error out, but leave the device with interrupts disabled, and thus touch not working. Fix it by moving the check before we disable interrupts/allocate memory for debug buffers. Fixes: fd335ab04b3f ("Input: edt-ft5x06 - add support for M09 firmware vers= ion") Reviewed-by: Andi Shyti Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/edt-ft5x06.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchsc= reen/edt-ft5x06.c index c53a3d7239e7..1e18ca0d1b4e 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_t= s_data *tsdata) int ret; int error; =20 + if (tsdata->version !=3D EDT_M06) { + dev_err(&client->dev, + "No factory mode support for non-M06 devices\n"); + return -EINVAL; + } + disable_irq(client->irq); =20 if (!tsdata->raw_buffer) { @@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts= _data *tsdata) } =20 /* mode register is 0x3c when in the work mode */ - if (tsdata->version !=3D EDT_M06) - goto m09_out; - error =3D edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03); if (error) { dev_err(&client->dev, @@ -559,11 +562,6 @@ err_out: enable_irq(client->irq); =20 return error; - -m09_out: - dev_err(&client->dev, "No factory mode support for M09/M12/GENERIC_FT\n")= ; - return -EINVAL; - } =20 static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata) --=20 2.15.1