Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp171573pxx; Wed, 28 Oct 2020 01:31:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFwStEgLybHArocT9jwpD+uW32jcrY0ngfCmF8o3VWpB40w4xuw5yDdQGjkLkiareaOv8+ X-Received: by 2002:a17:906:280a:: with SMTP id r10mr6343908ejc.58.1603873875939; Wed, 28 Oct 2020 01:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603873875; cv=none; d=google.com; s=arc-20160816; b=sgHAyrl4ztRTlabG+jpMoe78DU4iQk12wL4CteKUPxp852d5SjaYWIeN4+vSLmKUqU 1syBWGjc39+cb8rW5UplrpNTPfbiXZJ1ukgfqfuxgmnvVtSS5b7/HfkzeXsmOzKn2YV9 PWmaz4P0HfjNJ/124iqXQpUROmkWcIttXgirHFeCYeK5CK2cPAZV4+zA+DyxX70aYiv/ fwDwn52EngQn/m/11bohdsRmCDQ1xzVd+SvQ3A5fhwaY1x7lGfQM4vdjH4UQvhzncMjF eFMgCr/k41HledNlj3vOr7MQ1UekdZ+ywWF03JDWxg+VVJ/uDHo9z7FxGrB/5L0uKGy1 EkUg== 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=QayjXPBqZ4iKv4P1BXLeGSQdz2GrRvjFafgEZv4zzjz3guFRGP6Jzzsp5iP6Xbbx+2 a+0tO/e/hZ8nlVTyWD+x/ggy3zkCzvswbDxQk2TyGIkEfuzpmRwZjiPlLIYdvWyL2itB FCadXd6cCgWMIy0ccUEZVkOi9gJu9Yx+K2rEWyoNgbL9JvRVv+6D+K7wMp/eZQa2Gnqu 6BlMbNbQ7onpL763cO12uKhRgsBosouJ7icCxXF7Eu4B1CoVnNe0vl3HB+QLXC8644H7 f3S28jhXxJOKPVfPmEKFm5GKKIajjnuj89yXys0NyprJDW5rnfODvY+l+XUdzmNUb3Gf acEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UrTAwY2G; 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 p90si2749641edd.284.2020.10.28.01.30.53; Wed, 28 Oct 2020 01:31:15 -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=UrTAwY2G; 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 S1754446AbgJ0OFc (ORCPT + 99 others); Tue, 27 Oct 2020 10:05:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:53556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754374AbgJ0OFP (ORCPT ); Tue, 27 Oct 2020 10:05:15 -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 3512B2222C; Tue, 27 Oct 2020 14:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807514; bh=OrrQLVR1kDUnlCzLjRgqW/nqMZGWN2iMOP7koZ04DfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrTAwY2Gx/tkd+gDDytRgGuCpbaSIvsSknVZMbKukzbuauyX3HwI94vKRZb5eGQLS jw1HLC/BBNxjgQvoZmjoccPzrfZ8wnjDmzpbhhQeyUJBFGlVmGBqhD0IsYEheqVPtT bdL184+eJ8ObUnNS9CK/7SCQ4CJbDzfPtHil/B+Y= 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.9 081/139] Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Date: Tue, 27 Oct 2020 14:49:35 +0100 Message-Id: <20201027134905.975874141@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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