From: Julia Lawall Date: Mon, 21 Dec 2015 16:39:48 +0000 (+0100) Subject: pinctrl: mediatek: add missing of_node_put X-Git-Tag: v4.5-rc1~154^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fc8a4b2a4dd7704d950a01b1afec5e86af60565;p=platform%2Fkernel%2Flinux-exynos.git pinctrl: mediatek: add missing of_node_put for_each_child_of_node performs an of_node_get on each iteration, so a return from the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e,e1; @@ for_each_child_of_node(e1,n) { ... ( of_node_put(n); | e = n | return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index 8db7cdf..e22cbaf 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -598,6 +598,7 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_dt_free_map(pctldev, *map, *num_maps); + of_node_put(np); return ret; } }