Commit dab4df9c authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Linus Walleij

pinctrl: mediatek: Fix missing of_node_put() in mtk_pctrl_init

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

Fixes: a6df410d ("pinctrl: mediatek: Add Pinctrl/GPIO driver for mt8135.")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308071155.21114-1-linmq006@gmail.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a1d1e0e3
...@@ -1038,6 +1038,7 @@ int mtk_pctrl_init(struct platform_device *pdev, ...@@ -1038,6 +1038,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
node = of_parse_phandle(np, "mediatek,pctl-regmap", 0); node = of_parse_phandle(np, "mediatek,pctl-regmap", 0);
if (node) { if (node) {
pctl->regmap1 = syscon_node_to_regmap(node); pctl->regmap1 = syscon_node_to_regmap(node);
of_node_put(node);
if (IS_ERR(pctl->regmap1)) if (IS_ERR(pctl->regmap1))
return PTR_ERR(pctl->regmap1); return PTR_ERR(pctl->regmap1);
} else if (regmap) { } else if (regmap) {
...@@ -1051,6 +1052,7 @@ int mtk_pctrl_init(struct platform_device *pdev, ...@@ -1051,6 +1052,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
node = of_parse_phandle(np, "mediatek,pctl-regmap", 1); node = of_parse_phandle(np, "mediatek,pctl-regmap", 1);
if (node) { if (node) {
pctl->regmap2 = syscon_node_to_regmap(node); pctl->regmap2 = syscon_node_to_regmap(node);
of_node_put(node);
if (IS_ERR(pctl->regmap2)) if (IS_ERR(pctl->regmap2))
return PTR_ERR(pctl->regmap2); return PTR_ERR(pctl->regmap2);
} }
......
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