Thread (22 messages) 22 messages, 4 authors, 2017-05-25

Re: [PATCH v4 04/11] VAS: Define vas_init() and vas_exit()

From: Sukadev Bhattiprolu <hidden>
Date: 2017-05-25 05:29:48
Also in: lkml

Tyrel Datwyler [tyreld@linux.vnet.ibm.com] wrote:
quoted
+	vinst = &vas_instances[0];
+	for_each_node_by_name(dn, "vas") {
+		rc = init_vas_instance(dn, vinst);
+		if (rc) {
+			pr_err("Error %d initializing VAS instance %ld\n", rc,
+					(vinst-&vas_instances[0]));
You need a of_node_put(dn) here. The for_each_node_by_name() loop will get/put the
references of the device_node for you. However, if you bail out of the loop you are
responsible for the of_node_put() on the current *dn reference otherwise you will leak a
reference.
Thanks for the pointing it out.  Based on Ben's comments, I have modified this
code and no longer need to break out of the loop.

Sukadev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help