summaryrefslogtreecommitdiff
path: root/drivers/of/property.c
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2019-11-04 22:49:58 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-07 09:42:03 +0100
commitba861f8e07bf38c457b98e1abf6ecd9fd8c4ee92 (patch)
treedee03b516e60dfd86268abeb1dcb8e4b0d2b00ea /drivers/of/property.c
parentcc4c831811c2901b4b896c76ecb97212d73ad5aa (diff)
downloadlwn-ba861f8e07bf38c457b98e1abf6ecd9fd8c4ee92.tar.gz
lwn-ba861f8e07bf38c457b98e1abf6ecd9fd8c4ee92.zip
of: property: Minor style clean up of of_link_to_phandle()
Adding a debug log instead of silently ignoring a phandle for an early device. Also, return the right error code instead of 0 even though the actual execution flow won't change. Signed-off-by: Saravana Kannan <saravanak@google.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20191105065000.50407-2-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/of/property.c')
-rw-r--r--drivers/of/property.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/of/property.c b/drivers/of/property.c
index e225ab17f598..fbc201330ba0 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1051,8 +1051,14 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
is_populated = of_node_check_flag(sup_np, OF_POPULATED);
of_node_put(sup_np);
- if (!sup_dev)
- return is_populated ? 0 : -EAGAIN;
+ if (!sup_dev && is_populated) {
+ /* Early device without struct device. */
+ dev_dbg(dev, "Not linking to %pOFP - No struct device\n",
+ sup_np);
+ return -ENODEV;
+ } else if (!sup_dev) {
+ return -EAGAIN;
+ }
if (!device_link_add(dev, sup_dev, dl_flags))
ret = -EAGAIN;
put_device(sup_dev);