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

From: Sukadev Bhattiprolu
Date: Thu May 25 2017 - 01:29:51 EST


Tyrel Datwyler [tyreld@xxxxxxxxxxxxxxxxxx] 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