Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2338822imm; Thu, 7 Jun 2018 09:01:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIyDSj3akih7VET4DgOAWKpmgqdkLC6Efok+WPKQb1BLVrMgdD2iSue3hWBiI/YAEejmuXk X-Received: by 2002:a62:1c43:: with SMTP id c64-v6mr2296957pfc.176.1528387318696; Thu, 07 Jun 2018 09:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387318; cv=none; d=google.com; s=arc-20160816; b=OBGIl8HtHT26dm87kNAll86e0/CvoEcHaKDTm1f2rUa3WDESaYZcRhSiDYg5piT/Xm YOX2mDAkx7YBUvpdvCYMByPI4YEz9TNi+5jI8W3h0mxjHHVNfTcuxc53N+vfm0oQyWTo fCbgfWoAwHmDwisTnjMI5Vh9tnRcu3MbB7x9Rrjz85QbmfZpWjbfVhUP41crOZb+/1XY SvqVPPI4cMFPZy6n9WQIJ2c5H0qScJFRjGmvIcOqJxRMW9JYeu3bRCNfw82cUgskTmQI FRg5AlhBU5IIsc8oQTadGndUnVbR9SHnKkaj/KCAIAV6ajE9vXcn0TcqD7MZ4BHpaJiF IArA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=POdjFrm2FTwErh+y2RzqQeKS3KI+Q0AE86myeUwxwa8=; b=jz+SK3rX9L15b4KXmtDWNZ9RY5EMZju9kHguI3wnrnxwAdgiDT/B1F8Ag8EcyMa9w8 sQfNLIkVq7X6ITjwJD+Y5p6AVlwtqTbtZwuEf7ISaLVoSR326F7myV9xF20GFsrxoZ0X GKc/sLbxPKmSK/m4V+Bi1ZA8L+1fGa9qdfzziyE5tsA8aEbPUqaiT2U3DVECZLn0pgE2 rCT6T2eOh0/p+XsunjwIZBYR5MXKbeMoKjzlwlq4lAou5MxfFpbZKS4K8NrQfe5hC1Ky VN/8PTX3ThWj6k6hUR/ufOQbf0Wc9c4pgcncbk/6llKVOjdlEnGGKYfqc2e4xHC+y8uH t+dw== 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 i8-v6si9987557pgs.211.2018.06.07.09.01.43; Thu, 07 Jun 2018 09:01:58 -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 S935607AbeFGQAm (ORCPT + 99 others); Thu, 7 Jun 2018 12:00:42 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39315 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933040AbeFGOJG (ORCPT ); Thu, 7 Jun 2018 10:09:06 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvb7-0005Zs-9G; Thu, 07 Jun 2018 15:09:05 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb4-0002vz-18; Thu, 07 Jun 2018 15:09:02 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Dmitry Torokhov" , "Andi Shyti" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 163/410] Input: edt-ft5x06 - fix error handling for factory mode on non-M06 In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit 4b3e910d7f430ab76dd37131bb75129878950163 upstream. 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 version") Reviewed-by: Andi Shyti Signed-off-by: Dmitry Torokhov [bwh: Backported to 3.16: - s/EDT_M06/M06/ - Adjust context] Signed-off-by: Ben Hutchings --- drivers/input/touchscreen/edt-ft5x06.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -491,6 +491,12 @@ static int edt_ft5x06_factory_mode(struc int ret; int error; + if (tsdata->version != M06) { + dev_err(&client->dev, + "No factory mode support for non-M06 devices\n"); + return -EINVAL; + } + disable_irq(client->irq); if (!tsdata->raw_buffer) { @@ -504,9 +510,6 @@ static int edt_ft5x06_factory_mode(struc } /* mode register is 0x3c when in the work mode */ - if (tsdata->version == M09) - goto m09_out; - error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03); if (error) { dev_err(&client->dev, @@ -539,11 +542,6 @@ err_out: enable_irq(client->irq); return error; - -m09_out: - dev_err(&client->dev, "No factory mode support for M09\n"); - return -EINVAL; - } static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)