* [PATCH v2] usb: dwc3: add missing of_node_put and platform_device_put
@ 2023-11-14 10:16 Stanley Chang
2023-11-14 10:35 ` Sergey Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Stanley Chang @ 2023-11-14 10:16 UTC (permalink / raw)
To: Thinh Nguyen
Cc: Stanley Chang, Christophe JAILLET, Greg Kroah-Hartman, linux-usb,
linux-kernel
of_get_compatible_child performs an of_node_get, so an of_node_get is
required. Add platform_device_put to match with of_find_device_by_node.
Fixes: 34c200483569 ("usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver")
Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
v1 to v2 change:
1. Modify the commit message.
2. Add of_node_get in the of_property_read_string() error path.
---
drivers/usb/dwc3/dwc3-rtk.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c
index 590028e8fdcb..3cd6b184551c 100644
--- a/drivers/usb/dwc3/dwc3-rtk.c
+++ b/drivers/usb/dwc3/dwc3-rtk.c
@@ -183,10 +183,13 @@ static enum usb_device_speed __get_dwc3_maximum_speed(struct device_node *np)
ret = of_property_read_string(dwc3_np, "maximum-speed", &maximum_speed);
if (ret < 0)
- return USB_SPEED_UNKNOWN;
+ goto out;
ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed);
+out:
+ of_node_put(dwc3_np);
+
return (ret < 0) ? USB_SPEED_UNKNOWN : ret;
}
@@ -339,6 +342,9 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk)
switch_usb2_role(rtk, rtk->cur_role);
+ platform_device_put(dwc3_pdev);
+ of_node_put(dwc3_node);
+
return 0;
err_pdev_put:
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] usb: dwc3: add missing of_node_put and platform_device_put
2023-11-14 10:16 [PATCH v2] usb: dwc3: add missing of_node_put and platform_device_put Stanley Chang
@ 2023-11-14 10:35 ` Sergey Shtylyov
2023-11-14 11:12 ` Stanley Chang[昌育德]
0 siblings, 1 reply; 3+ messages in thread
From: Sergey Shtylyov @ 2023-11-14 10:35 UTC (permalink / raw)
To: Stanley Chang, Thinh Nguyen
Cc: Christophe JAILLET, Greg Kroah-Hartman, linux-usb, linux-kernel
On 11/14/23 1:16 PM, Stanley Chang wrote:
> of_get_compatible_child performs an of_node_get, so an of_node_get is
You mean of_node_put is required?
> required. Add platform_device_put to match with of_find_device_by_node.
>
> Fixes: 34c200483569 ("usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver")
> Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> v1 to v2 change:
> 1. Modify the commit message.
> 2. Add of_node_get in the of_property_read_string() error path.
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH v2] usb: dwc3: add missing of_node_put and platform_device_put
2023-11-14 10:35 ` Sergey Shtylyov
@ 2023-11-14 11:12 ` Stanley Chang[昌育德]
0 siblings, 0 replies; 3+ messages in thread
From: Stanley Chang[昌育德] @ 2023-11-14 11:12 UTC (permalink / raw)
To: Sergey Shtylyov, Thinh Nguyen
Cc: Christophe JAILLET, Greg Kroah-Hartman, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Hi Sergey,
> On 11/14/23 1:16 PM, Stanley Chang wrote:
>
> > of_get_compatible_child performs an of_node_get, so an of_node_get is
>
> You mean of_node_put is required?
Right, it is of_node_put.
I'm sorry for the typo.
Thanks,
Stanley
> > required. Add platform_device_put to match with of_find_device_by_node.
> >
> > Fixes: 34c200483569 ("usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer
> driver")
> > Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> > Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> > ---
> > v1 to v2 change:
> > 1. Modify the commit message.
> > 2. Add of_node_get in the of_property_read_string() error path.
> [...]
>
> MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-14 11:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 10:16 [PATCH v2] usb: dwc3: add missing of_node_put and platform_device_put Stanley Chang
2023-11-14 10:35 ` Sergey Shtylyov
2023-11-14 11:12 ` Stanley Chang[昌育德]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox