Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1239732pxa; Thu, 20 Aug 2020 06:30:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7hOUNG3MblEEl32RqpS5cmRV8KsbfG2ynKZ2lU79D8OdTFXS/eGsUUJr6WbPYF2MLFMo1 X-Received: by 2002:a17:906:a153:: with SMTP id bu19mr3196292ejb.142.1597930214984; Thu, 20 Aug 2020 06:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930214; cv=none; d=google.com; s=arc-20160816; b=sfMtCR/dDh+7mlKXh7XKle6pf0k8ie3e8JG7m7dqkw45U6q3vEd3QEEt+bEJhw1JNe xmc7Yhsek6xN3xeJ8REqJ+wU6o5ULNyedhTnHRKDrYdURPYOec5hWaKMETQVb8HLGxZ1 OdPDHOAPXV+UODJaC0/wGqpsrzpzOGKptAp6B3vpGWGrcE+gdpHZKR3h5fTDiozFnIVx bd+wA6OJTRk//8w52uBDPNn5cPXn8OC6FR3KSM61V3wkyNxBbB8Qd5ALF9wcK4cozCzU /VBx8OJG7ikFGVpHoBb2pTCPeuwxBFRGrnp6DaBKw7gLFW1O0PZxnycw331SfDLGf1uk AVYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SVkkUCHSTTFwyKOXuf8C36RB5qz0RJE/h4K6CYASIQ0=; b=HoOWYI9R6W4BqN6XocBNu9ltg2kdQWtRMa5f+XYpRDUuhp2kgb6dLX4KBPAm4bnDIs y4lTZlDJevJOtjuu3bj+MjShZxIf1cyZt1MKS0ye8PJhQr6LTq4/mlB/VCCxuAog2Z2m O4m1Q3RHpV966jVdFZDDLZ9obtZqH16tDJQbZFuguAt4z8hr3m8fUttDBM+jdZ7GT0vC 69zpm08oFvSPTugTrgRokPALbOKHUyN59jGVzpZ93IErnAiS9hcFyZUDO2T2LBDbf0Xj EOXr8lapp0AazL1K7a0dppJd+k1xbxmY9fL7ETwpIb89FOUNfztx7Sm6esc8NLsjVoog 5SOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CQ08dwbU; 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 q22si1221291ejn.410.2020.08.20.06.29.50; Thu, 20 Aug 2020 06:30:14 -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=CQ08dwbU; 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 S1728439AbgHTN3R (ORCPT + 99 others); Thu, 20 Aug 2020 09:29:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:44738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728391AbgHTJc7 (ORCPT ); Thu, 20 Aug 2020 05:32:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D03C621775; Thu, 20 Aug 2020 09:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915978; bh=ocubZFKj0D9EfDNzBRU77+U/K0QUAZCJOvfIuZRXxW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQ08dwbUYBFeK9c+jD2Y+mzI45AqAertKjfDuiLRd1tHUQet5PIydXBAKKaMOO2OX iMBzTzN8PrRMcsQCRXOCXax7mM9yamLBS9BxhcUJI/l+na3NgbSZYt9pXEp9D2WSsg PA53voBdIS8I+ORjWgoD8jZoTpwzCIKtvLBFwh2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Timur Tabi , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 202/232] net: qcom/emac: add missed clk_disable_unprepare in error path of emac_clks_phase1_init Date: Thu, 20 Aug 2020 11:20:53 +0200 Message-Id: <20200820091622.592773804@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Hai [ Upstream commit 50caa777a3a24d7027748e96265728ce748b41ef ] Fix the missing clk_disable_unprepare() before return from emac_clks_phase1_init() in the error handling case. Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver") Reported-by: Hulk Robot Signed-off-by: Wang Hai Acked-by: Timur Tabi Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qualcomm/emac/emac.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 20b1b43a0e393..1166b98d8bb2c 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -474,13 +474,24 @@ static int emac_clks_phase1_init(struct platform_device *pdev, ret = clk_prepare_enable(adpt->clk[EMAC_CLK_CFG_AHB]); if (ret) - return ret; + goto disable_clk_axi; ret = clk_set_rate(adpt->clk[EMAC_CLK_HIGH_SPEED], 19200000); if (ret) - return ret; + goto disable_clk_cfg_ahb; + + ret = clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); + if (ret) + goto disable_clk_cfg_ahb; - return clk_prepare_enable(adpt->clk[EMAC_CLK_HIGH_SPEED]); + return 0; + +disable_clk_cfg_ahb: + clk_disable_unprepare(adpt->clk[EMAC_CLK_CFG_AHB]); +disable_clk_axi: + clk_disable_unprepare(adpt->clk[EMAC_CLK_AXI]); + + return ret; } /* Enable clocks; needs emac_clks_phase1_init to be called before */ -- 2.25.1