summaryrefslogtreecommitdiff
path: root/drivers/base/swnode.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2019-10-03 15:32:08 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-10-11 12:26:55 +0300
commit51c100a651a471fcb8ead1ecc1224471eb0d61b9 (patch)
treec693be830e5cf2a06edbbab8a9b702fde67f2571 /drivers/base/swnode.c
parentda0c9ea146cbe92b832f1b0f694840ea8eb33cce (diff)
downloadlinux-51c100a651a471fcb8ead1ecc1224471eb0d61b9.tar.xz
software node: Get reference to parent swnode in get_parent op
The software_node_get_parent() returned a pointer to the parent swnode, but did not take a reference to it, leading the caller to put a reference that was not taken. Take that reference now. Fixes: 59abd83672f7 ("drivers: base: Introducing software nodes to the firmware node framework") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/swnode.c')
-rw-r--r--drivers/base/swnode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index a1f3f0994f9f..d5b4905e2adb 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -520,7 +520,10 @@ software_node_get_parent(const struct fwnode_handle *fwnode)
{
struct swnode *swnode = to_swnode(fwnode);
- return swnode ? (swnode->parent ? &swnode->parent->fwnode : NULL) : NULL;
+ if (!swnode || !swnode->parent)
+ return NULL;
+
+ return fwnode_handle_get(&swnode->parent->fwnode);
}
static struct fwnode_handle *