Commit 5c7f48dd authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski

pinctrl: samsung: Fix device node refcount leaks in Exynos wakeup controller init

In exynos_eint_wkup_init() the for_each_child_of_node() loop is used
with a break to find a matching child node.  Although each iteration of
for_each_child_of_node puts the previous node, but early exit from loop
misses it.  This leads to leak of device node.

Cc: <stable@vger.kernel.org>
Fixes: 43b169db ("pinctrl: add exynos4210 specific extensions for samsung pinctrl driver")
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent 3d2557ab
...@@ -506,6 +506,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -506,6 +506,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
bank->nr_pins, &exynos_eint_irqd_ops, bank); bank->nr_pins, &exynos_eint_irqd_ops, bank);
if (!bank->irq_domain) { if (!bank->irq_domain) {
dev_err(dev, "wkup irq domain add failed\n"); dev_err(dev, "wkup irq domain add failed\n");
of_node_put(wkup_np);
return -ENXIO; return -ENXIO;
} }
...@@ -520,8 +521,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -520,8 +521,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
weint_data = devm_kcalloc(dev, weint_data = devm_kcalloc(dev,
bank->nr_pins, sizeof(*weint_data), bank->nr_pins, sizeof(*weint_data),
GFP_KERNEL); GFP_KERNEL);
if (!weint_data) if (!weint_data) {
of_node_put(wkup_np);
return -ENOMEM; return -ENOMEM;
}
for (idx = 0; idx < bank->nr_pins; ++idx) { for (idx = 0; idx < bank->nr_pins; ++idx) {
irq = irq_of_parse_and_map(bank->of_node, idx); irq = irq_of_parse_and_map(bank->of_node, idx);
...@@ -538,10 +541,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) ...@@ -538,10 +541,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
} }
} }
if (!muxed_banks) if (!muxed_banks) {
of_node_put(wkup_np);
return 0; return 0;
}
irq = irq_of_parse_and_map(wkup_np, 0); irq = irq_of_parse_and_map(wkup_np, 0);
of_node_put(wkup_np);
if (!irq) { if (!irq) {
dev_err(dev, "irq number for muxed EINTs not found\n"); dev_err(dev, "irq number for muxed EINTs not found\n");
return 0; return 0;
......
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