From: Amitoj Kaur Chawla Date: Fri, 22 Jan 2016 18:08:38 +0000 (+0530) Subject: bus: vexpress-config: Add missing of_node_put X-Git-Tag: v4.13~3681^2~2^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d99875eebfebec5432981273fac0547f3e34f2d7;p=mirror_ubuntu-bionic-kernel.git bus: vexpress-config: Add missing of_node_put for_each_compatible_node performs an of_node_get on each iteration, so to break out of the loop an of_node_put is required. Found using Coccinelle. The semantic patch used for this is as follows: // @@ expression e; local idexpression n; @@ for_each_compatible_node(n, ...) { ... when != of_node_put(n) when != e = n ( return n; + of_node_put(n); ? return ...; ) ... } // Acked-by: Liviu Dudau Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Sudeep Holla --- diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c index 6575c0fe6a4e..c3cb76b363c6 100644 --- a/drivers/bus/vexpress-config.c +++ b/drivers/bus/vexpress-config.c @@ -192,8 +192,10 @@ static int __init vexpress_config_init(void) /* Need the config devices early, before the "normal" devices... */ for_each_compatible_node(node, NULL, "arm,vexpress,config-bus") { err = vexpress_config_populate(node); - if (err) + if (err) { + of_node_put(node); break; + } } return err;