Received: by 10.223.176.46 with SMTP id f43csp389226wra; Fri, 26 Jan 2018 00:11:05 -0800 (PST) X-Google-Smtp-Source: AH8x224TLQzOkQMZcrtBcSWroyvpORg5unQ3vlgGHqI8JxX58LB8l3sBx8izfTl3lzke/05SQV47 X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr4155888plt.70.1516954265380; Fri, 26 Jan 2018 00:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516954265; cv=none; d=google.com; s=arc-20160816; b=TyLM4NfKph9/apXc6IyXEZtzcY9jOZd7+5M22wusChiMJPBWJwvtvV3/4dbgYNMLXB HJgkY0R0Wb2NvD1JcjBfZEr0CAZ9L+z2WruylePmHyFTAXLNHDC+MyZze/3OAjzpDONt pqwxsveUJZBBBfVtgmsaDP9WJ1ORiTz6GZv+qmFXdPDgyN4fGwmO0rVCmQqeC/boDram fc3eQE4bb2+zrK+bcL464KuyEkbfspCxkgi29qrjXHq617RNmfRcaWCe6Y/T2V8JN3jw TrBmf04RFr80zhlKAp9ey1HFtZsXbcrqUG+BV3GXOYqz6a4vdX1JLylO+ImJMV8T38t4 X4DQ== 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:message-id:in-reply-to:date:references:subject:cc:to :from:arc-authentication-results; bh=B0TI8ozQtO0NmQY6ZfoYRDmIt4BhxcSh4zsZs/Tl0V8=; b=kQA1kftJ+/THb4ijnScrnwblSmBsgV2i4MuhJVIzFJRJXnqw3S4IlTzSAsgYVV69Sb LXrwCc2E1whVzvFMbL9RfQdob7/SSUMaOBEfaHX9BmhIhYnn4WKPjWdGtTaG+2VdXbhr 2N7AR5SU/hTQyTKPSbtpRtIHAayLlYv8AxmITsPjxbKwkSq+fjqr+CCGj3L4cejWMSzI WoJq8GvZ6dUkx1Ty+RJdkzod7A6C02WXU/2yRZXQl4OOyHxtOlplGlD2GXeAjO41YFsD ljZfmwA11RLFXkStTzejoDoOzk6yhI2MmIrwb0YSVKnIdUmN2I6pz6mda+PT8sZlXtz/ VlWQ== ARC-Authentication-Results: i=1; mx.google.com; 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 i11si2679478pgp.337.2018.01.26.00.10.51; Fri, 26 Jan 2018 00:11:05 -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; 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 S1752241AbeAZIKW convert rfc822-to-8bit (ORCPT + 99 others); Fri, 26 Jan 2018 03:10:22 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:58428 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752219AbeAZIKT (ORCPT ); Fri, 26 Jan 2018 03:10:19 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id D092820E5D; Fri, 26 Jan 2018 09:10:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.free-electrons.com (Postfix) with ESMTPSA id 965B52088B; Fri, 26 Jan 2018 09:10:07 +0100 (CET) From: Gregory CLEMENT To: Christophe JAILLET Cc: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] spi: orion: Fix a resource leak if the optional "axi" clk is deferred References: <20180125201617.17099-1-christophe.jaillet@wanadoo.fr> Date: Fri, 26 Jan 2018 09:10:07 +0100 In-Reply-To: <20180125201617.17099-1-christophe.jaillet@wanadoo.fr> (Christophe JAILLET's message of "Thu, 25 Jan 2018 21:16:17 +0100") Message-ID: <87fu6t2g80.fsf@free-electrons.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) 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 Hi Christophe, On jeu., janv. 25 2018, Christophe JAILLET wrote: > If the optional "axi" clk is deferred, we still need to undo some > initialisation. Espacially 'master' must be released. It will be Especially > 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 Thanks, Gregory > --- > 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.14.1 > > > --- > L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. > https://www.avast.com/antivirus > -- Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com