Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp589112pxx; Wed, 28 Oct 2020 11:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgUmnQ5hMTQxA6zMAslJ6+86vJo+py7US4YFrwZoCGtq53GDiWD75fYFg08o34H2P+t3D6 X-Received: by 2002:a17:906:3413:: with SMTP id c19mr429728ejb.421.1603911001074; Wed, 28 Oct 2020 11:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603911001; cv=none; d=google.com; s=arc-20160816; b=03pi0bR8RpP1Ctt8EkgBlK2MYNjNt7bkpyP7s94aQjLLEzWbgrwdO4NNl9uAxP6n6j 0RIj3IMXro1NC2BOlZXNm5i0RYrEcpjJcmmEY3zkcs+SxBEHIQbss4HtGFszwqraIBBh wpnS/XuibWMpqYvZlrPMZi1Oj09/g02CNywDO1caW0QhpKgXKO5PFRc78DRXWsBUyVqy GO+7E5rOEJgfWoyBpaVYcJrxaB9773VKbhPlnNv9rZ8FfaShL8jfOBP4JYGrcMOIa0Ol smWl5ZHj8LTXAt6DppyZHM+64vVMOueIu6nqcW+iqRploL/7cJZsBBCREaWsEibEsSoD nVsQ== 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=ZJMEJnFpJ4C1fegcZzRBxB05Z0PCwJAoiWNuXDakd8M=; b=r9ZY5TMQyhtZW0Pmgpkinq4P+23ElmAydcpwz30DrwhT4Mmv+lvLayO+BxjKQPJI3y rmhe8vOf+/oOtI9acum2QutYFabkXWIkU2z5Zp6qKO5emR+b1FmVGH1OpQiLerBgzUCg Ub2EF7WDqBTepOy3W0aR4W9/uhOBTduesgDSvOrDTsTsWZpiCsoa0bL6IS2sf94ygv6w nSuhbEphecQbuvsRzLmFNEJmDEcptmfoB6SXl9xISI+N10s/cNO/ar9FV3UWscNTqYeI vJR8f+irUFKLP8QzjlqDPg0K2xyF0i68MRLZU4TbMIxjqrpv+h5+mAnRYtWigYvbSLVK /+wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rwSUjHFm; 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 d23si26051edr.183.2020.10.28.11.49.38; Wed, 28 Oct 2020 11:50:01 -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=rwSUjHFm; 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 S2901226AbgJ0SOa (ORCPT + 99 others); Tue, 27 Oct 2020 14:14:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2507508AbgJ0ONS (ORCPT ); Tue, 27 Oct 2020 10:13:18 -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 6E5C722264; Tue, 27 Oct 2020 14:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807997; bh=IhAHUeQv3iGIi5lX21gGYYHdMiD64DRAne2mqC1o/oE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwSUjHFmlSU0udF9qBlLJ8s17YQdV1sWDcuqujU+lGUKaoX10BnakhgutZCwt8RGM KEHDlccFgeTaCkPYU0yBjTpI5k4uTJEkOMUndUi8IPWz3ZPR3Hud3p94dFO8nK8it6 1upFgetL7ayGs+G9j3SdgtFrpzJzhfPA0MY5MEdE= 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.14 119/191] Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Date: Tue, 27 Oct 2020 14:49:34 +0100 Message-Id: <20201027134915.421721907@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 ee82a975bfd29..5759c1592a456 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -542,20 +542,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