linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: tegra: Add a missing 'of_node_put()' call
@ 2017-01-04  7:13 Christophe JAILLET
  2017-01-25  6:57 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-01-04  7:13 UTC (permalink / raw)
  To: swarren, thierry.reding, gnurou
  Cc: linux-tegra, linux-kernel, kernel-janitors, Christophe JAILLET

If 'of_find_device_by_node()' fails, an 'of_node_put()' call is missing in
the error handling path.
Fix it by reordering the code.

While at it, remove some empty lines in a more or less similar construction
a few lines below.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/memory/tegra/tegra124-emc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c
index 06cc781ebac1..392dc8dd481f 100644
--- a/drivers/memory/tegra/tegra124-emc.c
+++ b/drivers/memory/tegra/tegra124-emc.c
@@ -1115,11 +1115,10 @@ static int tegra_emc_probe(struct platform_device *pdev)
 	}
 
 	mc = of_find_device_by_node(np);
+	of_node_put(np);
 	if (!mc)
 		return -ENOENT;
 
-	of_node_put(np);
-
 	emc->mc = platform_get_drvdata(mc);
 	if (!emc->mc)
 		return -EPROBE_DEFER;
@@ -1135,9 +1134,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
 	}
 
 	err = tegra_emc_load_timings_from_dt(emc, np);
-
 	of_node_put(np);
-
 	if (err)
 		return err;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] memory: tegra: Add a missing 'of_node_put()' call
  2017-01-04  7:13 [PATCH] memory: tegra: Add a missing 'of_node_put()' call Christophe JAILLET
@ 2017-01-25  6:57 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2017-01-25  6:57 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: swarren, gnurou, linux-tegra, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On Wed, Jan 04, 2017 at 08:13:24AM +0100, Christophe JAILLET wrote:
> If 'of_find_device_by_node()' fails, an 'of_node_put()' call is missing in
> the error handling path.
> Fix it by reordering the code.
> 
> While at it, remove some empty lines in a more or less similar construction
> a few lines below.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/memory/tegra/tegra124-emc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-25  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04  7:13 [PATCH] memory: tegra: Add a missing 'of_node_put()' call Christophe JAILLET
2017-01-25  6:57 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).