Received: by 10.223.176.46 with SMTP id f43csp654212wra; Fri, 26 Jan 2018 04:55:04 -0800 (PST) X-Google-Smtp-Source: AH8x225D/duX7BhIU5HbL/g1a/jyyi6MuaTKu72MXtxqNUfFGSVaTZGLQR2Hv3FDCVMqjlTdG05Y X-Received: by 2002:a17:902:b909:: with SMTP id bf9-v6mr14776127plb.218.1516971304699; Fri, 26 Jan 2018 04:55:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516971304; cv=none; d=google.com; s=arc-20160816; b=iu0VzZfhYicMIxZy6fUqCAf8L0slkKDEau8NkLyVXJMrVXpn7o1pfdyXRcjt+PC91M MCW0tyyV8uMflgANnUkFmmFEU+YfRU84M7+OUnrBDeYqSJ4jrvi16GMTFA34pHVT4jC1 KBVqLIs0PD2iqWLNqqZriyXnC46hp8uMwL9agPeBww+atHMCh5aqXIcIPOiFvvmT8/vN 4Rm1uflfUfLXIT8clgvJdgkakgaoznxeMTQODcIch3znow19nA+P10LJ/i+a8EWlbby1 OAJht0vXH3lZgUAB+BPaE+S5IJWn0kEnnz9Mo6pVT40bduD9exjpC5+juTplPOnvxHzB ySPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=GbzURHfGNkN3YcwKmmH953Oz4IzFPGl0jVCrWFyYS/A=; b=RIsXES0xPt4FL2wUmKw/iglT/qboIJnBNBcwe2urUrJaR172gvLSqrKircMTuquNaf Ri+No4MqTHVsTZQfukSY+CgfSihUWZbfmGvj6kUkej3iv05xZxGC70IeoIogJqV7GeSh nbwYzaca+z4CsH6XyvmBa4TsIagczfOBsTP3d68DT2l244wOjGFTCpWfwcv7DZhJDx8X uFX1rqBISRuDYL4Iqu7qot7MSWMnyRQrDCsPqAvRnmA9R6/VVPSmMYiaBrIR1E9ZRse+ P3kjgHs6aR5KRHYNIsuS6Ci/EScdXGUZ05CPFhBRwnz0HSzPHlB9Iw3i1HSpzO8X3JC8 nc8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=DAeS6wTm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si2974817pgp.442.2018.01.26.04.54.50; Fri, 26 Jan 2018 04:55:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=DAeS6wTm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908AbeAZMy0 (ORCPT + 99 others); Fri, 26 Jan 2018 07:54:26 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:37968 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbeAZMyY (ORCPT ); Fri, 26 Jan 2018 07:54:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=GbzURHfGNkN3YcwKmmH953Oz4IzFPGl0jVCrWFyYS/A=; b=DAeS6wTmmlW7 WldHneG6kdVMMTMVuC2UGgAmx0vydB9nMd8QiwHKNuqiOkojmCeWKsf9uY+k99V80UVX4S9RjcA2k LT+KAVSsKTGkUk5Gs+yUJ3SYmCwNmuEGlLJGpfJR//uH8MSXOGZfprs1he8XSODFe26iyDJfyV6ib P3yDQ=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ef3WP-0006u5-No; Fri, 26 Jan 2018 12:54:21 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1ef3WP-0002Mh-9A; Fri, 26 Jan 2018 12:54:21 +0000 From: Mark Brown To: Christophe Jaillet Cc: Christophe JAILLET , Gregory CLEMENT , Mark Brown , broonie@kernel.org, gregory.clement@free-electrons.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-spi@vger.kernel.org Subject: Applied "spi: orion: Fix a resource leak if the optional "axi" clk is deferred" to the spi tree In-Reply-To: <20180125201617.17099-1-christophe.jaillet@wanadoo.fr> Message-Id: Date: Fri, 26 Jan 2018 12:54:21 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: orion: Fix a resource leak if the optional "axi" clk is deferred has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 479c03a7173d07b2967f9b521159271543d99e2f Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Thu, 25 Jan 2018 21:16:17 +0100 Subject: [PATCH] spi: orion: Fix a resource leak if the optional "axi" clk is deferred If the optional "axi" clk is deferred, we still need to undo some initialisation. Especially 'master' must be released. It will be reallocated the next time 'orion_spi_probe()' is called. Add a new label to clean what needs to be cleaned and rename another label to improve the names used. Fixes: 92ae112e477a ("spi: orion: Fix clock resource by adding an optional bus clock") Signed-off-by: Christophe JAILLET Acked-by: Gregory CLEMENT Signed-off-by: Mark Brown --- drivers/spi/spi-orion.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 482a0cf3b7aa..deca63e82ff6 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -638,8 +638,10 @@ static int orion_spi_probe(struct platform_device *pdev) /* The following clock is only used by some SoCs */ spi->axi_clk = devm_clk_get(&pdev->dev, "axi"); if (IS_ERR(spi->axi_clk) && - PTR_ERR(spi->axi_clk) == -EPROBE_DEFER) - return -EPROBE_DEFER; + PTR_ERR(spi->axi_clk) == -EPROBE_DEFER) { + status = -EPROBE_DEFER; + goto out_rel_clk; + } if (!IS_ERR(spi->axi_clk)) clk_prepare_enable(spi->axi_clk); @@ -667,7 +669,7 @@ static int orion_spi_probe(struct platform_device *pdev) spi->base = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(spi->base)) { status = PTR_ERR(spi->base); - goto out_rel_clk; + goto out_rel_axi_clk; } /* Scan all SPI devices of this controller for direct mapped devices */ @@ -705,7 +707,7 @@ static int orion_spi_probe(struct platform_device *pdev) PAGE_SIZE); if (!spi->direct_access[cs].vaddr) { status = -ENOMEM; - goto out_rel_clk; + goto out_rel_axi_clk; } spi->direct_access[cs].size = PAGE_SIZE; @@ -733,8 +735,9 @@ static int orion_spi_probe(struct platform_device *pdev) out_rel_pm: pm_runtime_disable(&pdev->dev); -out_rel_clk: +out_rel_axi_clk: clk_disable_unprepare(spi->axi_clk); +out_rel_clk: clk_disable_unprepare(spi->clk); out: spi_master_put(master); -- 2.15.1