Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp254564pxx; Wed, 28 Oct 2020 04:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIlcA4sCDmpzO7G957B50YzPSaUbrq6xc4P/FpodjWztR9PbpwpIwX3OTXQz4xA9H1/wsB X-Received: by 2002:a50:e686:: with SMTP id z6mr7075777edm.188.1603883541474; Wed, 28 Oct 2020 04:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603883541; cv=none; d=google.com; s=arc-20160816; b=wskrXxY1Obftu9bWqbBH/57CrKmQOF7C4sQ5Mi9OrBKE8jsJXEMulXBT/kyA8AOyJz kxkbCg/gG/h4qzxUD0YwdtrMj3dM9mAjG6EMSRL1IZBSpq4+zMYG+zISWNdn4XiyOoem lb+qUVWPdINqrGzUXm/zvH6kg09AmQ57pFG9ESK2lh+gCSf1zao/FK+pO3YcY+dvmE2y W7ycJs49x+aj2ITBwfifLwBZSp0L2Bnf1WMQl181VSPq3eEAMTGnzzcYZvNEAQO84//v N2k890Xh/MRDjfHjjhMhlXQceiJMCZoQGmUl3XhwwmMdH4buMiM/jqb6XWSkr1HqkADE 0ybg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qq3sM1Xuvveg5mhgST8ePRcrp4ulK9LD+Qs9w4RlbVI=; b=i3ZQdAnkGKyxwQaRoAHdJfA8bAPisrp/7d9O0mOVb5MBNVLbbk5SI/PxzrvQ89+tKE 8RQB90Mci53L/+lnLEdhmCDSZm/6gk/a8D5ExNDRqo20Gtkrda90Kzk3nCZIMKaoeCca WboQnia6RXsSCKgOBlKfnj9u/x8DzHlvL5HnKsUfwoNZGGJEt0NFJ9pOFQ0Qc3KFMC+z dk5KUIAhLszeep2XHLSkdp2yiiO/hGB89IetzT13t0VQyb9oHChiu+HNmr1AyAV9qYT5 vuszOuirgw/eZ/paA+oI0RcpSMVJr9uA+unzdQ+HRponZ2go2w0Yn6nXiDADoVM4LqkN 1nqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zX3EJS2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs17si3022913ejb.543.2020.10.28.04.11.59; Wed, 28 Oct 2020 04:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zX3EJS2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1787194AbgJ0PAA (ORCPT + 99 others); Tue, 27 Oct 2020 11:00:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:42648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762439AbgJ0Omy (ORCPT ); Tue, 27 Oct 2020 10:42:54 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDFC3206E5; Tue, 27 Oct 2020 14:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809773; bh=KEqOOfrAnkfyiT2/q98UFhQvP+8j/UPZzmzHPa4vKyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zX3EJS2kzJfXKffc+z7I8NCOUSkNlvqXzXqL5EEbX3jzWD9/o7LPLzuFvoLG/TVI2 BFOHYXzW9jFosEn6oOJ1U0PL0DP3r6GiZUmPNSJM1gUDHT7f6lNYaWivItFaA8lF9t wRRhrHWJCwH6QBSlNkwJGRPeQLQuHX/ogwXYux5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.4 284/408] Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Date: Tue, 27 Oct 2020 14:53:42 +0100 Message-Id: <20201027135508.225508790@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 30df23c5ecdfb8da5b0bc17ceef67eff9e1b0957 ] If imx6ul_tsc_init() fails then we need to clean up the clocks. I reversed the "if (input_dev->users) {" condition to make the code a bit simpler. Fixes: 6cc527b05847 ("Input: imx6ul_tsc - propagate the errors") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20200905124942.GC183976@mwanda Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/imx6ul_tsc.c | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index 9ed258854349b..5e6ba5c4eca2a 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) { - retval = clk_prepare_enable(tsc->adc_clk); - if (retval) - goto out; - - retval = clk_prepare_enable(tsc->tsc_clk); - if (retval) { - clk_disable_unprepare(tsc->adc_clk); - goto out; - } + if (!input_dev->users) + goto out; - retval = imx6ul_tsc_init(tsc); + retval = clk_prepare_enable(tsc->adc_clk); + if (retval) + goto out; + + retval = clk_prepare_enable(tsc->tsc_clk); + if (retval) { + clk_disable_unprepare(tsc->adc_clk); + goto out; } + retval = imx6ul_tsc_init(tsc); + if (retval) { + clk_disable_unprepare(tsc->tsc_clk); + clk_disable_unprepare(tsc->adc_clk); + goto out; + } out: mutex_unlock(&input_dev->mutex); return retval; -- 2.25.1