From: 王擎 <wangqing@vivo.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: phy: add missing of_node_put before return
Date: Tue, 14 Dec 2021 02:14:13 +0000 [thread overview]
Message-ID: <SL2PR06MB308280CD1F51C87B171D1F64BD759@SL2PR06MB3082.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <ALAA5ABiE1JEtj4aLwAwtqpi.9.1639393400698.Hmail.wangqing@vivo.com.@PFliY29jQlpCQUphWjBSZjZAc2hlbGwuYXJtbGludXgub3JnLnVrPg==>
>> From: Wang Qing <wangqing@vivo.com>
>>
>> Fix following coccicheck warning:
>> WARNING: Function "for_each_available_child_of_node"
>> should have of_node_put() before return.
>>
>> Early exits from for_each_available_child_of_node should decrement the
>> node reference counter.
>
>Most *definitely* NAK. Coccicheck is most definitely wrong on this one,
>and we will probably need some way to tell people not to believe
>coccicheck on this.
>
>In this path, the DT node is assigned to a struct device. This _must_
>be reference counted. device_set_node() does not increment the
>reference count, nor does of_fwnode_handle(). The reference count
>here is passed from this code over to the struct device.
>
>Adding an of_node_put() will break this.
>
>This must _never_ be "fixed" no matter how much coccicheck complains,
>as fixing the warning _will_ introduce a refcounting bug.
>
>I'll send a patch adding a comment to this effect.
>
>Thanks.
Yes, you are right. Maybe we can add a judgment in this cocci on which exit as expected
or abnormally, only the latter needs to be reported.
Thanks,
Qing
>
>--
>RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
>FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
prev parent reply other threads:[~2021-12-14 2:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 9:44 Qing Wang
2021-12-13 11:03 ` Russell King (Oracle)
[not found] ` <ALAA5ABiE1JEtj4aLwAwtqpi.9.1639393400698.Hmail.wangqing@vivo.com.@PFliY29jQlpCQUphWjBSZjZAc2hlbGwuYXJtbGludXgub3JnLnVrPg==>
2021-12-14 2:14 ` 王擎 [this message]
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=SL2PR06MB308280CD1F51C87B171D1F64BD759@SL2PR06MB3082.apcprd06.prod.outlook.com \
--to=wangqing@vivo.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®