Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp163219pxx; Wed, 28 Oct 2020 01:13:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx07L1wfKRlfplL6Y5+ysdVKeeXW6b13lAdM3ctS+Uk/azj/Z4TlzvMIYs3GGsMOSBgc3L X-Received: by 2002:a05:6402:2d7:: with SMTP id b23mr928133edx.196.1603872820305; Wed, 28 Oct 2020 01:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872820; cv=none; d=google.com; s=arc-20160816; b=P9cxUMqCqAKgqnkO19p2coVDiF+YaQ/od6tYr8nSj4la0PI/PRnJIz9dLnmGyAXBhQ gDiUzbT41P2qyRPHRELr0CX/PFdC6XwCP0Mu2EtbYzHgmEJWbxeutUNvpn+1k72MsIKW gD1O7nsLwMU/GoLOLCP4k4GYNy0GTQKRLShP9WkdMT+Y2czPri/T7Raa13L+qgoT5Jyb /PjpHhdwNz/w+ADrTBFKpmQjqZUbLzJ3LmH9B2lywtjJWUGTBF2QJaEk/+qsj5CcX23o RGsVVqdCOaYinIYigeV3FvAIIzBbfkyH7QgDIikjQFzpS88PGGlwum22ztLO4tum8gRx vQDg== 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=lI1PiZtEljr3vmi72Z0m5pRfYr9C63vatetiSUMdYOw=; b=ioJ2YwHQMAtyVnzmATlVtF5WGgxdczQY7L4w/JFJ6i4UX+qysBltwGJjmY3yWGo78y Zj4T1ya0WqsuEcQGxhmla+74+pfmdqMduaZ65Qj7I5itVaXP7xpp8/0GTC7DtDGGwgwR 9AnQOUF3NXcV9pXcQGqPmuFh+Z09fhCb2mOCwX4qbV6F4QMmWaCnKD/5d3M7FGarlUO+ hQkNmhMJ5au2W/hLZ0Kj0UVroRwyGVocN6tH2kC3utNNekZtGAUBSvReGIl91MEwDRlS czTd6Kak1Bd1VcLyLmYeZ9VVES9Au7xKRvayWU2UnFSs+SFjQSgpxlO0pq7s7hiKt7Rr yJxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0FNWCNtL; 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 d4si2698178edr.173.2020.10.28.01.13.18; Wed, 28 Oct 2020 01:13:40 -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=0FNWCNtL; 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 S1753280AbgJ0N7e (ORCPT + 99 others); Tue, 27 Oct 2020 09:59:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2411495AbgJ0N73 (ORCPT ); Tue, 27 Oct 2020 09:59:29 -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 272EC2068D; Tue, 27 Oct 2020 13:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807168; bh=OrrQLVR1kDUnlCzLjRgqW/nqMZGWN2iMOP7koZ04DfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0FNWCNtLNTPFjkWjxpow41BIc/+lVAPwQFReKTBngB6CcaAMC+pZhS392tcU4NdUa noLZeKog0K/E5FGVrdjjjQE4nwr2uRvf/h6tGR1fVND2ajdyRBFctkwufkj2OM6fQq edrqBaR+GQ+GiK0Br77qfi5GF3X6uFPSvd7LxroM= 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 4.4 068/112] Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Date: Tue, 27 Oct 2020 14:49:38 +0100 Message-Id: <20201027134903.784483256@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 8275267eac254..4be7ddc04af0f 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -490,20 +490,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