Skip to content

Commit

Permalink
of: property: Minor style clean up of of_link_to_phandle()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Saravana Kannan authored and Greg Kroah-Hartman committed Nov 7, 2019
1 parent cc4c831 commit ba861f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/of/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ba861f8

Please sign in to comment.