* [PATCH v2] usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name()
@ 2022-09-15 9:22 Liang He
2022-09-16 9:58 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-09-15 9:22 UTC (permalink / raw)
To: heikki.krogerus, gregkh, linux-usb; +Cc: windhl
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: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
Signed-off-by: Liang He <windhl@126.com>
---
v2: use of_get_child_by_name() advised by Heikki Krogerus.
drivers/usb/typec/anx7411.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index c0f0842d443c..f178d0eb47b1 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -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;
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name()
2022-09-15 9:22 [PATCH v2] usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name() Liang He
@ 2022-09-16 9:58 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2022-09-16 9:58 UTC (permalink / raw)
To: Liang He; +Cc: gregkh, linux-usb
On Thu, Sep 15, 2022 at 05:22:09PM +0800, Liang He wrote:
> 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: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
> Signed-off-by: Liang He <windhl@126.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>
> v2: use of_get_child_by_name() advised by Heikki Krogerus.
>
> drivers/usb/typec/anx7411.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index c0f0842d443c..f178d0eb47b1 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -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;
>
> @@ -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;
thanks,
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-16 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 9:22 [PATCH v2] usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name() Liang He
2022-09-16 9:58 ` Heikki Krogerus
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.