From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032662AbdEYF3s (ORCPT ); Thu, 25 May 2017 01:29:48 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48439 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032445AbdEYF3p (ORCPT ); Thu, 25 May 2017 01:29:45 -0400 Date: Wed, 24 May 2017 22:29:29 -0700 From: Sukadev Bhattiprolu To: Tyrel Datwyler Cc: Michael Ellerman , stewart@linux.vnet.ibm.com, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, apopple@au1.ibm.com, oohall@gmail.com, michael.neuling@au1.ibm.com Subject: Re: [PATCH v4 04/11] VAS: Define vas_init() and vas_exit() References: <1490937224-29149-1-git-send-email-sukadev@linux.vnet.ibm.com> <1490937224-29149-5-git-send-email-sukadev@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.7.1 (2016-10-04) X-TM-AS-GCONF: 00 x-cbid: 17052505-0044-0000-0000-00000338B1E9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007113; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00865290; UDB=6.00429635; IPR=6.00645067; BA=6.00005372; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015576; XFM=3.00000015; UTC=2017-05-25 05:29:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052505-0045-0000-0000-00000766BFE2 Message-Id: <20170525052929.GE26091@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-25_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705250107 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tyrel Datwyler [tyreld@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