Re: [PATCH v1 28/28] leds: sgm3140: Put fwnode in any case during ->probe()
From: Andy Shevchenko <hidden>
Date: 2021-05-29 09:58:24
Also in:
lkml
On Fri, May 28, 2021 at 2:01 PM Andy Shevchenko [off-list ref] wrote:
On Fri, May 28, 2021 at 12:14:54PM +0200, Pavel Machek wrote:quoted
Hi!quoted
fwnode_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.This (and similar) -- in half of the drivers we hold the handle from successful probe. Is it a problem and why is it problem only for some drivers?Hmm... I'm not sure I have understood the question correctly. Any examples of the driver that you think needs some attention? In general the idea is that these kind of for-loops or getting next fwnode should be balanced. In case of for-loops the error or any other breakage means that reference count is bumped, for the get_next API it's always the case. I have checked between drivers and only considered above cases. Wherever there is a for-loop which isn't broken, we are fine. Wherever we have explicit reference counter drop for get_next cases, we are fine. If (any) framework requires the resource to be present that framework should bump and drop reference count on the resource by itself (so I split LED framework out from the consideration and consider that it does the right things)quoted
Thanks for series, btw, I pushed out current version of the tree.Should I rebase the new version on something I can find in your Git tree?
I found the above is good justification, so I leave those patches unchanged in v2. -- With Best Regards, Andy Shevchenko