From: Julia Lawall Date: Sat, 15 Jul 2017 16:27:41 +0000 (+0200) Subject: mmc: atmel-mci: add missing of_node_put X-Git-Tag: v4.14-rc1~116^2~119 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7366419b5e72e12b705a9cdd5d18abf421668113;p=uclinux-h8%2Flinux.git mmc: atmel-mci: add missing of_node_put for_each_child_of_node performs an of_node_get on each iteration, so a break out the loop requires an of_node_put. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e,e1; iterator name for_each_child_of_node; @@ for_each_child_of_node(e1,n) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // Signed-off-by: Julia Lawall Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 53e30b0504b5..dcd028760c25 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -673,6 +673,7 @@ atmci_of_init(struct platform_device *pdev) if (slot_id >= ATMCI_MAX_NR_SLOTS) { dev_warn(&pdev->dev, "can't have more than %d slots\n", ATMCI_MAX_NR_SLOTS); + of_node_put(cnp); break; }