Commit 6f296a96 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Krzysztof Kozlowski

memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe

The device_node pointer is returned by of_parse_phandle() with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 87108dc7 ("memory: atmel-ebi: Enable the SMC clock if specified")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220309110144.22412-1-linmq006@gmail.comSigned-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent b452dbf2
...@@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev) ...@@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
ebi->smc.regmap = syscon_node_to_regmap(smc_np); ebi->smc.regmap = syscon_node_to_regmap(smc_np);
if (IS_ERR(ebi->smc.regmap)) if (IS_ERR(ebi->smc.regmap)) {
return PTR_ERR(ebi->smc.regmap); ret = PTR_ERR(ebi->smc.regmap);
goto put_node;
}
ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
if (IS_ERR(ebi->smc.layout)) if (IS_ERR(ebi->smc.layout)) {
return PTR_ERR(ebi->smc.layout); ret = PTR_ERR(ebi->smc.layout);
goto put_node;
}
ebi->smc.clk = of_clk_get(smc_np, 0); ebi->smc.clk = of_clk_get(smc_np, 0);
if (IS_ERR(ebi->smc.clk)) { if (IS_ERR(ebi->smc.clk)) {
if (PTR_ERR(ebi->smc.clk) != -ENOENT) if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
return PTR_ERR(ebi->smc.clk); ret = PTR_ERR(ebi->smc.clk);
goto put_node;
}
ebi->smc.clk = NULL; ebi->smc.clk = NULL;
} }
of_node_put(smc_np);
ret = clk_prepare_enable(ebi->smc.clk); ret = clk_prepare_enable(ebi->smc.clk);
if (ret) if (ret)
return ret; return ret;
...@@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev) ...@@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
} }
return of_platform_populate(np, NULL, NULL, dev); return of_platform_populate(np, NULL, NULL, dev);
put_node:
of_node_put(smc_np);
return ret;
} }
static __maybe_unused int atmel_ebi_resume(struct device *dev) static __maybe_unused int atmel_ebi_resume(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment