* [PATCH 0/3] usb: dwc3: xilinx: minor fixes for dwc3-xilinx glue driver
@ 2026-05-11 16:08 Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter Radhey Shyam Pandey
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Radhey Shyam Pandey @ 2026-05-11 16:08 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh, michal.simek, p.zabel
Cc: linux-usb, linux-arm-kernel, linux-kernel, git,
Radhey Shyam Pandey
Minor cleanups and a bug fix for the dwc3-xilinx glue driver:
- Fix a comment style violation (missing space before closing delimiter).
- Use reset_control_reset in versal init.
- Fix phy resource leak in zynqmp init error paths where phy_init() and
phy_power_on() resources were not properly released on failure.
Radhey Shyam Pandey (3):
usb: dwc3: xilinx: fix missing space before closing comment delimiter
usb: dwc3: xilinx: use reset_control_reset() in versal init
usb: dwc3: xilinx: fix error handling in zynqmp init error paths
drivers/usb/dwc3/dwc3-xilinx.c | 45 +++++++++++++++-------------------
1 file changed, 20 insertions(+), 25 deletions(-)
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
--
2.44.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter
2026-05-11 16:08 [PATCH 0/3] usb: dwc3: xilinx: minor fixes for dwc3-xilinx glue driver Radhey Shyam Pandey
@ 2026-05-11 16:08 ` Radhey Shyam Pandey
2026-05-14 1:23 ` Thinh Nguyen
2026-05-11 16:08 ` [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths Radhey Shyam Pandey
2 siblings, 1 reply; 7+ messages in thread
From: Radhey Shyam Pandey @ 2026-05-11 16:08 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh, michal.simek, p.zabel
Cc: linux-usb, linux-arm-kernel, linux-kernel, git,
Radhey Shyam Pandey
Add missing space before '*/' in an inline comment to follow
the kernel coding style.
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
drivers/usb/dwc3/dwc3-xilinx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index f41b0da5e89d..a3c7dc258c7d 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -196,7 +196,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
}
if (priv_data->usb3_phy) {
- /* Set PIPE Power Present signal in FPD Power Present Register*/
+ /* Set PIPE Power Present signal in FPD Power Present Register */
writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
/* Set the PIPE Clock Select bit in FPD PIPE Clock register */
writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
--
2.44.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init
2026-05-11 16:08 [PATCH 0/3] usb: dwc3: xilinx: minor fixes for dwc3-xilinx glue driver Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter Radhey Shyam Pandey
@ 2026-05-11 16:08 ` Radhey Shyam Pandey
2026-05-14 1:34 ` Thinh Nguyen
2026-05-11 16:08 ` [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths Radhey Shyam Pandey
2 siblings, 1 reply; 7+ messages in thread
From: Radhey Shyam Pandey @ 2026-05-11 16:08 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh, michal.simek, p.zabel
Cc: linux-usb, linux-arm-kernel, linux-kernel, git,
Radhey Shyam Pandey
Replace separate reset_control_assert() and reset_control_deassert() calls
with reset_control_reset(), which pulses the reset in one step. Report
failures with dev_err_probe() and a single message. No functional change.
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
drivers/usb/dwc3/dwc3-xilinx.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index a3c7dc258c7d..94458b3da1a0 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -98,18 +98,10 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)
dwc3_xlnx_mask_phy_rst(priv_data, false);
- /* Assert and De-assert reset */
- ret = reset_control_assert(crst);
- if (ret < 0) {
- dev_err_probe(dev, ret, "failed to assert Reset\n");
- return ret;
- }
-
- ret = reset_control_deassert(crst);
- if (ret < 0) {
- dev_err_probe(dev, ret, "failed to De-assert Reset\n");
- return ret;
- }
+ /* assert and deassert reset */
+ ret = reset_control_reset(crst);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to assert and deassert reset\n");
dwc3_xlnx_mask_phy_rst(priv_data, true);
dwc3_xlnx_set_coherency(priv_data, XLNX_USB2_TRAFFIC_ROUTE_CONFIG);
--
2.44.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths
2026-05-11 16:08 [PATCH 0/3] usb: dwc3: xilinx: minor fixes for dwc3-xilinx glue driver Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init Radhey Shyam Pandey
@ 2026-05-11 16:08 ` Radhey Shyam Pandey
2026-05-14 1:43 ` Thinh Nguyen
2 siblings, 1 reply; 7+ messages in thread
From: Radhey Shyam Pandey @ 2026-05-11 16:08 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh, michal.simek, p.zabel
Cc: linux-usb, linux-arm-kernel, linux-kernel, git,
Radhey Shyam Pandey, stable
Fix error handling and resource cleanup i.e remove invalid
phy_exit() after failed phy_init(), route failures through
proper cleanup paths and return 0 explicitly on success.
Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
drivers/usb/dwc3/dwc3-xilinx.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 94458b3da1a0..b832505e1b04 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -176,15 +176,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
}
ret = phy_init(priv_data->usb3_phy);
- if (ret < 0) {
- phy_exit(priv_data->usb3_phy);
+ if (ret < 0)
goto err;
- }
ret = reset_control_deassert(apbrst);
if (ret < 0) {
dev_err(dev, "Failed to release APB reset\n");
- goto err;
+ goto err_phy_exit;
}
if (priv_data->usb3_phy) {
@@ -200,26 +198,24 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
ret = reset_control_deassert(crst);
if (ret < 0) {
dev_err(dev, "Failed to release core reset\n");
- goto err;
+ goto err_phy_exit;
}
ret = reset_control_deassert(hibrst);
if (ret < 0) {
dev_err(dev, "Failed to release hibernation reset\n");
- goto err;
+ goto err_phy_exit;
}
ret = phy_power_on(priv_data->usb3_phy);
- if (ret < 0) {
- phy_exit(priv_data->usb3_phy);
- goto err;
- }
+ if (ret < 0)
+ goto err_phy_exit;
/* ulpi reset via gpio-modepin or gpio-framework driver */
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(reset_gpio)) {
- return dev_err_probe(dev, PTR_ERR(reset_gpio),
- "Failed to request reset GPIO\n");
+ ret = PTR_ERR(reset_gpio);
+ goto err_phy_power_off;
}
if (reset_gpio) {
@@ -229,6 +225,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
}
dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG);
+
+ return 0;
+
+err_phy_power_off:
+ phy_power_off(priv_data->usb3_phy);
+err_phy_exit:
+ phy_exit(priv_data->usb3_phy);
err:
return ret;
}
--
2.44.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter
2026-05-11 16:08 ` [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter Radhey Shyam Pandey
@ 2026-05-14 1:23 ` Thinh Nguyen
0 siblings, 0 replies; 7+ messages in thread
From: Thinh Nguyen @ 2026-05-14 1:23 UTC (permalink / raw)
To: Radhey Shyam Pandey
Cc: Thinh Nguyen, gregkh@linuxfoundation.org, michal.simek@amd.com,
p.zabel@pengutronix.de, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, git@amd.com
On Mon, May 11, 2026, Radhey Shyam Pandey wrote:
> Add missing space before '*/' in an inline comment to follow
> the kernel coding style.
>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> drivers/usb/dwc3/dwc3-xilinx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index f41b0da5e89d..a3c7dc258c7d 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -196,7 +196,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> }
>
> if (priv_data->usb3_phy) {
> - /* Set PIPE Power Present signal in FPD Power Present Register*/
> + /* Set PIPE Power Present signal in FPD Power Present Register */
> writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
> /* Set the PIPE Clock Select bit in FPD PIPE Clock register */
> writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
> --
> 2.44.4
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
BR,
Thinh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init
2026-05-11 16:08 ` [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init Radhey Shyam Pandey
@ 2026-05-14 1:34 ` Thinh Nguyen
0 siblings, 0 replies; 7+ messages in thread
From: Thinh Nguyen @ 2026-05-14 1:34 UTC (permalink / raw)
To: Radhey Shyam Pandey
Cc: Thinh Nguyen, gregkh@linuxfoundation.org, michal.simek@amd.com,
p.zabel@pengutronix.de, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, git@amd.com
On Mon, May 11, 2026, Radhey Shyam Pandey wrote:
> Replace separate reset_control_assert() and reset_control_deassert() calls
> with reset_control_reset(), which pulses the reset in one step. Report
> failures with dev_err_probe() and a single message. No functional change.
>
The behavior of reset_control_reset() is a little different. I wouldn't
call this "No functional change". However, I assumed this was tested.
Please provide a proper reason for this change in the change log.
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> drivers/usb/dwc3/dwc3-xilinx.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index a3c7dc258c7d..94458b3da1a0 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -98,18 +98,10 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)
>
> dwc3_xlnx_mask_phy_rst(priv_data, false);
>
> - /* Assert and De-assert reset */
> - ret = reset_control_assert(crst);
> - if (ret < 0) {
> - dev_err_probe(dev, ret, "failed to assert Reset\n");
> - return ret;
> - }
> -
> - ret = reset_control_deassert(crst);
> - if (ret < 0) {
> - dev_err_probe(dev, ret, "failed to De-assert Reset\n");
> - return ret;
> - }
> + /* assert and deassert reset */
> + ret = reset_control_reset(crst);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to assert and deassert reset\n");
>
> dwc3_xlnx_mask_phy_rst(priv_data, true);
> dwc3_xlnx_set_coherency(priv_data, XLNX_USB2_TRAFFIC_ROUTE_CONFIG);
> --
> 2.44.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths
2026-05-11 16:08 ` [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths Radhey Shyam Pandey
@ 2026-05-14 1:43 ` Thinh Nguyen
0 siblings, 0 replies; 7+ messages in thread
From: Thinh Nguyen @ 2026-05-14 1:43 UTC (permalink / raw)
To: Radhey Shyam Pandey
Cc: Thinh Nguyen, gregkh@linuxfoundation.org, michal.simek@amd.com,
p.zabel@pengutronix.de, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, git@amd.com, stable@vger.kernel.org
On Mon, May 11, 2026, Radhey Shyam Pandey wrote:
> Fix error handling and resource cleanup i.e remove invalid
> phy_exit() after failed phy_init(), route failures through
> proper cleanup paths and return 0 explicitly on success.
>
> Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
> Cc: stable@vger.kernel.org
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> drivers/usb/dwc3/dwc3-xilinx.c | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index 94458b3da1a0..b832505e1b04 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -176,15 +176,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> }
>
> ret = phy_init(priv_data->usb3_phy);
> - if (ret < 0) {
> - phy_exit(priv_data->usb3_phy);
> + if (ret < 0)
> goto err;
> - }
>
> ret = reset_control_deassert(apbrst);
> if (ret < 0) {
> dev_err(dev, "Failed to release APB reset\n");
> - goto err;
> + goto err_phy_exit;
> }
>
> if (priv_data->usb3_phy) {
> @@ -200,26 +198,24 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> ret = reset_control_deassert(crst);
> if (ret < 0) {
> dev_err(dev, "Failed to release core reset\n");
> - goto err;
> + goto err_phy_exit;
> }
>
> ret = reset_control_deassert(hibrst);
> if (ret < 0) {
> dev_err(dev, "Failed to release hibernation reset\n");
> - goto err;
> + goto err_phy_exit;
> }
>
> ret = phy_power_on(priv_data->usb3_phy);
> - if (ret < 0) {
> - phy_exit(priv_data->usb3_phy);
> - goto err;
> - }
> + if (ret < 0)
> + goto err_phy_exit;
>
> /* ulpi reset via gpio-modepin or gpio-framework driver */
> reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> if (IS_ERR(reset_gpio)) {
> - return dev_err_probe(dev, PTR_ERR(reset_gpio),
> - "Failed to request reset GPIO\n");
> + ret = PTR_ERR(reset_gpio);
> + goto err_phy_power_off;
> }
>
> if (reset_gpio) {
> @@ -229,6 +225,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> }
>
> dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG);
> +
> + return 0;
> +
> +err_phy_power_off:
> + phy_power_off(priv_data->usb3_phy);
> +err_phy_exit:
> + phy_exit(priv_data->usb3_phy);
> err:
> return ret;
> }
> --
> 2.44.4
>
This fix should be a separate patch from this cleanup series.
Thanks,
Thinh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-05-14 1:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 16:08 [PATCH 0/3] usb: dwc3: xilinx: minor fixes for dwc3-xilinx glue driver Radhey Shyam Pandey
2026-05-11 16:08 ` [PATCH 1/3] usb: dwc3: xilinx: fix missing space before closing comment delimiter Radhey Shyam Pandey
2026-05-14 1:23 ` Thinh Nguyen
2026-05-11 16:08 ` [PATCH 2/3] usb: dwc3: xilinx: use reset_control_reset() in versal init Radhey Shyam Pandey
2026-05-14 1:34 ` Thinh Nguyen
2026-05-11 16:08 ` [PATCH 3/3] usb: dwc3: xilinx: fix error handling in zynqmp init error paths Radhey Shyam Pandey
2026-05-14 1:43 ` Thinh Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox