linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.ibm.com>
To: Liang He <windhl@126.com>,
	mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	linuxppc-dev@lists.ozlabs.org, linmq006@gmail.com
Subject: Re: [PATCH] powerpc: kernel: pci_dn: Add missing of_node_put() for of_get_xx API
Date: Fri, 1 Jul 2022 15:18:52 -0700	[thread overview]
Message-ID: <81fa33cc-32ea-4132-6b26-013d19f899c2@linux.ibm.com> (raw)
In-Reply-To: <09bcb7d7-5c27-04cc-6796-cbeb3d0abb14@linux.ibm.com>

On 7/1/22 12:47, Tyrel Datwyler wrote:
> On 7/1/22 06:17, Liang He wrote:
>> In pci_add_device_node_info(), we should use of_node_put() for the
>> reference 'parent' returned by of_get_parent() to keep refcount
>> balance.
>>
>> Fixes: cca87d303c85 ("powerpc/pci: Refactor pci_dn")
>> Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
>> Signed-off-by: Liang He <windhl@126.com>
>> ---
>>  arch/powerpc/kernel/pci_dn.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
>> index 938ab8838ab5..aa221958007e 100644
>> --- a/arch/powerpc/kernel/pci_dn.c
>> +++ b/arch/powerpc/kernel/pci_dn.c
>> @@ -330,6 +330,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
>>  	INIT_LIST_HEAD(&pdn->list);
>>  	parent = of_get_parent(dn);
>>  	pdn->parent = parent ? PCI_DN(parent) : NULL;
> NACK
> 
> pdn->parent is now a long term reference so we should not do a put on parent
> until we pdn->parent is no longer valid.

I withdraw my NACK. On closer inspection pdn->parent is a reference to the
parent struct pci_dn and not a reference to a parent struct device_node.

Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>

> 
> -Tyrel
> 
>> +	of_node_put(parent);
>>  	if (pdn->parent)
>>  		list_add_tail(&pdn->list, &pdn->parent->child_list);
>>
> 


  parent reply	other threads:[~2022-07-01 22:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 13:17 [PATCH] powerpc: kernel: pci_dn: Add missing of_node_put() for of_get_xx API Liang He
2022-07-01 19:47 ` Tyrel Datwyler
2022-07-01 21:36   ` Liang He
2022-07-01 22:18   ` Tyrel Datwyler [this message]
2022-09-09 12:07 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81fa33cc-32ea-4132-6b26-013d19f899c2@linux.ibm.com \
    --to=tyreld@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linmq006@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=windhl@126.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).