]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 0a42179d1902b0a9b2aa10c68abe774e8f8d52e3 Mon Sep 17 00:00:00 2001 |
2 | From: Wen Yang <wen.yang99@zte.com.cn> | |
3 | Date: Fri, 12 Apr 2019 14:02:19 +0800 | |
4 | Subject: pinctrl: pistachio: fix leaked of_node references | |
5 | ||
6 | [ Upstream commit 44a4455ac2c6b0981eace683a2b6eccf47689022 ] | |
7 | ||
8 | The call to of_get_child_by_name returns a node pointer with refcount | |
9 | incremented thus it must be explicitly decremented after the last | |
10 | usage. | |
11 | ||
12 | Detected by coccinelle with the following warnings: | |
13 | ./drivers/pinctrl/pinctrl-pistachio.c:1422:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1360, but without a corresponding object release within this function. | |
14 | ||
15 | Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> | |
16 | Cc: Linus Walleij <linus.walleij@linaro.org> | |
17 | Cc: linux-gpio@vger.kernel.org | |
18 | Cc: linux-kernel@vger.kernel.org | |
19 | Signed-off-by: Linus Walleij <linus.walleij@linaro.org> | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | drivers/pinctrl/pinctrl-pistachio.c | 2 ++ | |
23 | 1 file changed, 2 insertions(+) | |
24 | ||
25 | diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c | |
26 | index 98a459b1c095a..86e8d989092c8 100644 | |
27 | --- a/drivers/pinctrl/pinctrl-pistachio.c | |
28 | +++ b/drivers/pinctrl/pinctrl-pistachio.c | |
29 | @@ -1373,6 +1373,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) | |
30 | if (!of_find_property(child, "gpio-controller", NULL)) { | |
31 | dev_err(pctl->dev, | |
32 | "No gpio-controller property for bank %u\n", i); | |
33 | + of_node_put(child); | |
34 | ret = -ENODEV; | |
35 | goto err; | |
36 | } | |
37 | @@ -1380,6 +1381,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) | |
38 | irq = irq_of_parse_and_map(child, 0); | |
39 | if (irq < 0) { | |
40 | dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); | |
41 | + of_node_put(child); | |
42 | ret = irq; | |
43 | goto err; | |
44 | } | |
45 | -- | |
46 | 2.20.1 | |
47 |