From: sashiko-bot@kernel.org
To: "Minda Chen" <minda.chen@starfivetech.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v1 3/3] usb: dwc3-generic: Add Starfive JHB100 USB 2.0 device controller and adapter
Date: Fri, 18 Sep 2026 07:19:56 +0000 [thread overview]
Message-ID: <20260918071957.1628E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918071103.24482-4-minda.chen@starfivetech.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] usb: improper handling of optional adapter resource masks legitimate errors
- [Low] usb: missing static keyword on jhb100_glue_ops causes namespace pollution
--
commit e26d59375d5e4555d239557e241788e437655348
Author: Minda Chen <minda.chen@starfivetech.com>
usb: dwc3-generic: Add Starfive JHB100 USB 2.0 device controller and adapter
This patch introduces the Starfive JHB100 USB 2.0 device controller and
its associated PHY adapter settings to the generic DWC3 driver. It adds
io memory mappings for the adapter and implements pre-run/stop operations
to appropriately toggle the adapter port enable bit during gadget enumeration.
diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index ca69ac0eb07ce..e3394205a5197 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
[ ... ]
> +static void dwc3_jhb100_pre_run_stop(struct dwc3 *dwc3, bool start)
> +{
> + struct dwc3_generic *data = to_dwc3_generic(dwc3);
> + u32 val;
> +
> + if (start) {
> + val = readl(data->phy_regs);
> + val |= JHB100_ADAPTER_PORT_EN;
> + writel(val, data->phy_regs);
> + } else {
> + val = readl(data->phy_regs);
> + val &= ~JHB100_ADAPTER_PORT_EN;
> + writel(val, data->phy_regs);
> + }
> +}
> +
> +struct dwc3_glue_ops jhb100_glue_ops = {
[Severity: Low]
Could this struct be marked static and const?
Since jhb100_glue_ops is only assigned to dwc3g->dwc.glue_ops locally within
drivers/usb/dwc3/dwc3-generic-plat.c, leaving it globally exposed might lead
to link-time symbol collisions or sparse warnings.
> + .pre_run_stop = dwc3_jhb100_pre_run_stop,
> +};
> +
> +static int dwc3_jhb100_init(struct dwc3_generic *dwc3g)
> +{
> + struct platform_device *pdev = to_platform_device(dwc3g->dev);
> +
> + dwc3g->phy_regs = devm_platform_ioremap_resource_byname(pdev, "adapter");
> + if (IS_ERR(dwc3g->phy_regs)) {
[Severity: Medium]
Will this error handling mask legitimate failures?
The adapter resource appears to be optional here since dwc3_jhb100_init() falls
back to generic behavior when it is missing. However, using
devm_platform_ioremap_resource_byname() on an absent resource will
unconditionally log an invalid resource error via dev_err_probe(), potentially
spamming the kernel log on platforms where it is intentionally omitted.
Additionally, checking IS_ERR() here will catch all other errors like -ENOMEM
or -EBUSY and silently downgrade capabilities by returning 0, instead of
propagating the real failure to the caller.
> + dwc3g->phy_regs = NULL;
> + /* Generic bmc USB with PHY*/
> + return 0;
> + }
> +
> + /* usb device controller with adapter */
> + dwc3g->dwc.glue_ops = &jhb100_glue_ops;
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918071103.24482-1-minda.chen@starfivetech.com?part=3
next prev parent reply other threads:[~2026-09-18 7:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 7:11 [PATCH v1 0/3] Add StarFive JHB100 host field USB device controller driver Minda Chen
2026-09-18 7:11 ` [PATCH v1 1/3] dt-bindings: usb: dwc3: Add JHB100 device controller PHY adapter Minda Chen
2026-09-22 17:15 ` Conor Dooley
2026-09-24 4:03 ` Minda Chen
2026-09-24 16:18 ` Conor Dooley
2026-09-18 7:11 ` [PATCH v1 2/3] dt-bindings: usb: dwc3: Add JHB100 USB device clock number limit Minda Chen
2026-09-18 7:11 ` [PATCH v1 3/3] usb: dwc3-generic: Add Starfive JHB100 USB 2.0 device controller and adapter Minda Chen
2026-09-18 7:19 ` sashiko-bot [this message]
2026-10-02 1:49 ` Thinh Nguyen
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=20260918071957.1628E1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=minda.chen@starfivetech.com \
--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