From: sashiko-bot@kernel.org
To: "Jon Hunter" <jonathanh@nvidia.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 09/12] usb: gadget: tegra-xudc: Add support for Tegra238
Date: Mon, 16 Nov 2026 15:54:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-217318@kernel.org> (raw)
In-Reply-To: <20261116-tegra-usb-v2-9-42efc03a9700@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: gadget: tegra-xudc: unconditional reset assert in
tegra_xudc_remove()
--
commit 01f4840c1e0e2937e62224e3b8e14a7ec36d25bd
Author: Jon Hunter <jonathanh@nvidia.com>
usb: gadget: tegra-xudc: Add support for Tegra238
This commit adds Tegra238 SoC support to the Tegra XUDC driver, managing
the xusb_dev and xusb_ss resets instead of power domains when
has_powergates is false.
> diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
> index 43a1940ed88ab..3d7254d6ebcd1 100644
> --- a/drivers/usb/gadget/udc/tegra-xudc.c
> +++ b/drivers/usb/gadget/udc/tegra-xudc.c
[ ... ]
> @@ -3916,6 +3958,23 @@ static int tegra_xudc_probe(struct platform_device *pdev)
> return err;
> }
>
> +static void tegra_xudc_assert_resets(struct tegra_xudc *xudc)
> +{
> + int err;
> +
> + err = reset_control_assert(xudc->dev_rst);
> + if (err)
> + dev_err(xudc->dev, "failed to assert device reset: %d\n", err);
> +
> + /*
> + * Release the shared SS reset vote even if the device reset fails,
> + * otherwise the next activation adds an unbalanced deassert vote.
> + */
> + err = reset_control_assert(xudc->ss_rst);
> + if (err)
> + dev_err(xudc->dev, "failed to assert SS reset: %d\n", err);
> +}
> +
> static void tegra_xudc_remove(struct platform_device *pdev)
> {
> struct tegra_xudc *xudc = platform_get_drvdata(pdev);
> @@ -3931,7 +3990,10 @@ static void tegra_xudc_remove(struct platform_device *pdev)
> tegra_xudc_free_eps(xudc);
> tegra_xudc_free_event_ring(xudc);
>
> - tegra_xudc_powerdomain_remove(xudc);
> + if (xudc->soc->has_powergates)
> + tegra_xudc_powerdomain_remove(xudc);
> + else
> + tegra_xudc_assert_resets(xudc);
[Severity: Medium]
Can tegra_xudc_remove() call tegra_xudc_assert_resets() when xudc does not
hold a deassert vote on xudc->ss_rst?
tegra_xudc_probe() only acquires dev_rst and ss_rst, leaving them to be
deasserted by tegra_xudc_activate() on runtime resume. In
tegra_xudc_remove(), pm_runtime_get_sync() is called without checking its
return value before tegra_xudc_assert_resets() runs unconditionally. If
tegra_xudc_activate() fails (after already unwinding its reset
deassertions) or never runs when runtime PM is disabled in the kernel
configuration, reset_control_assert(xudc->ss_rst) will underflow
deassert_count in __reset_control_assert() or drop the shared SuperSpeed
reset vote held by the active xhci-tegra host controller.
Also, when pm_runtime_get_sync() succeeds, tegra_xudc_free_eps() and
tegra_xudc_free_event_ring() free the coherent transfer and event rings
while the controller, clocks, and bus mastering are still enabled, before
tegra_xudc_assert_resets() asserts the resets.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-tegra-usb-v2-0-42efc03a9700@nvidia.com?part=9
next prev parent reply other threads:[~2026-11-16 15:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 15:23 [PATCH v2 00/12] usb: Add support for Tegra238 and device support for Tegra264 Jon Hunter
2026-11-16 15:23 ` [PATCH v2 01/12] dt-bindings: usb: tegra234-xusb: Add required properties Jon Hunter
2026-11-16 15:23 ` [PATCH v2 02/12] dt-bindings: usb: Add Tegra238 XUSB host controller support Jon Hunter
2026-11-16 15:38 ` sashiko-bot
2026-11-16 15:24 ` [PATCH v2 03/12] dt-bindings: usb: tegra-xudc: Add Tegra238 XUDC support Jon Hunter
2026-11-16 15:24 ` [PATCH v2 04/12] dt-bindings: usb: tegra-xudc: Add Tegra264 " Jon Hunter
2026-11-16 15:24 ` [PATCH v2 05/12] usb: xhci: tegra: Fix missing semi-colon Jon Hunter
2026-11-16 15:24 ` [PATCH v2 06/12] usb: xhci: tegra: Add support for Tegra238 Jon Hunter
2026-11-16 15:24 ` [PATCH v2 07/12] usb: gadget: tegra-xudc: Fix CNT65 configuration Jon Hunter
2026-11-16 15:24 ` [PATCH v2 08/12] usb: gadget: tegra-xudc: Preserve runtime PM across system suspend Jon Hunter
2026-11-16 15:24 ` [PATCH v2 09/12] usb: gadget: tegra-xudc: Add support for Tegra238 Jon Hunter
2026-11-16 15:54 ` sashiko-bot [this message]
2026-11-16 15:24 ` [PATCH v2 10/12] usb: gadget: tegra-xudc: Add SSPX register offset to SoC data Jon Hunter
2026-11-16 15:24 ` [PATCH v2 11/12] usb: gadget: tegra-xudc: Add default settings " Jon Hunter
2026-11-16 15:24 ` [PATCH v2 12/12] usb: gadget: tegra-xudc: Add support for Tegra264 Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-217318@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox