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

Sukadev Bhattiprolu sukadev at linux.vnet.ibm.com
Thu May 25 15:29:29 AEST 2017


Tyrel Datwyler [tyreld at linux.vnet.ibm.com] wrote:
> > +	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



More information about the Linuxppc-dev mailing list