Thread (37 messages) 37 messages, 3 authors, 2019-09-02

Re: [PATCH v3 05/10] device property: Add a function to obtain a node's prefix

From: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: 2019-09-02 07:29:30
Also in: linux-acpi, lkml

Hi Andy,

On Fri, Aug 30, 2019 at 03:46:57PM +0300, Andy Shevchenko wrote:
On Thu, Aug 29, 2019 at 01:10:38PM +0300, Sakari Ailus wrote:
quoted
The prefix is used for printing purpose before a node, and it also works
as a separator between two nodes.
quoted
+	/* Is this the root node? */
+	parent = fwnode_get_parent(fwnode);
+	if (!parent)
+		return "";
+
+	/* Is this 2nd node from the root? */
+	parent = fwnode_get_next_parent(parent);
+	if (!parent)
Can we theoretically have a case when we got parent != NULL and thus taken
reference, while the 2nd one is NULL and we leak reference here (and in all
similar places)?
fwnode_get_next_parent() releases that reference unconditionally.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help