Skip to content

Commit

Permalink
usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_no…
Browse files Browse the repository at this point in the history
…de_by_name()

[ Upstream commit e45d733 ]

In anx7411_typec_switch_probe(), we should call of_get_child_by_name()
instead of of_find_node_by_name() as of_find_xxx API will decrease the
refcount of the 'from' argument.

Fixes: fe6d8a9 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220915092209.4009273-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
windhl authored and gregkh committed Oct 21, 2022
1 parent 7569034 commit b9d28d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/typec/anx7411.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ static int anx7411_typec_switch_probe(struct anx7411_data *ctx,
int ret;
struct device_node *node;

node = of_find_node_by_name(dev->of_node, "orientation_switch");
node = of_get_child_by_name(dev->of_node, "orientation_switch");
if (!node)
return 0;

Expand All @@ -1115,7 +1115,7 @@ static int anx7411_typec_switch_probe(struct anx7411_data *ctx,
return ret;
}

node = of_find_node_by_name(dev->of_node, "mode_switch");
node = of_get_child_by_name(dev->of_node, "mode_switch");
if (!node) {
dev_err(dev, "no typec mux exist");
ret = -ENODEV;
Expand Down

0 comments on commit b9d28d6

Please sign in to comment.