All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 2/2] ARM: dts: broadcom: model USB VBUS power with regulator-fixed
Date: Sun, 20 Sep 2026 21:27:14 +0000	[thread overview]
Message-ID: <20260920212715.6D5761F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260920211356.186967-3-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] usb: bcma: ABI breakage on older Device Trees due to missing regulator
- [High] usb: bcma: regulator enable count leaked on error paths and remove
- [Low] build: missing closing brace in bcma_hcd_probe() causes compilation failure
--

commit 2da0c63e158c66b33d97e363d8f72cf580a7db29
Author: Rosen Penev <rosenp@gmail.com>

usb: bcma: control VBUS via a regulator instead of a GPIO

This commit replaces the undocumented "vcc-gpio" property handling with the
standard regulator interface. Each core obtains its VBUS supply via
devm_regulator_get_optional() and the regulator core reference-counts the
enable/disable requests to avoid conflicts.

> diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
> index 519386255886c..394ba9e5a7f77 100644
> --- a/drivers/usb/host/bcma-hcd.c
> +++ b/drivers/usb/host/bcma-hcd.c

[ ... ]

> @@ -405,11 +411,14 @@ static int bcma_hcd_probe(struct bcma_device *core)
>  		return -ENOMEM;
>  	usb_dev->core = core;
>  
> -	usb_dev->gpio_desc = devm_gpiod_get_optional(&core->dev, "vcc",
> -						     GPIOD_OUT_HIGH);
> -	if (IS_ERR(usb_dev->gpio_desc))
> -		return dev_err_probe(&core->dev, PTR_ERR(usb_dev->gpio_desc),
> -				     "error obtaining VCC GPIO");
> +	usb_dev->regulator = devm_regulator_get_optional(&core->dev, "vbus");
> +	if (IS_ERR(usb_dev->regulator)) {
> +		return PTR_ERR(usb_dev->regulator);

[Severity: Critical]
Is it possible this unconditional return breaks backward compatibility with
older device trees?

Since devm_regulator_get_optional() returns -ENODEV when the regulator is
absent, returning this error will fail probe entirely on older setups rather
than proceeding without it.

[Severity: Low]
Does this code have a missing closing brace?

The if block is opened here but the closing brace is missing, incorrectly
scoping the rest of the function and breaking compilation.

> +
> +	err = regulator_enable(usb_dev->regulator);

[Severity: High]
Does this code leak the regulator enable count?

If bcma_hcd_probe() encounters an error later in the initialization sequence
after regulator_enable() has succeeded:

drivers/usb/host/bcma-hcd.c:bcma_hcd_probe() {
    ...
	switch (core->id.id) {
    ...
	}
	if (err)
		return err;
    ...
}

It returns without calling regulator_disable().

Similarly, does bcma_hcd_remove() also leak the regulator enable count?

When the module is unbound, it fails to invoke regulator_disable(), which
would leave the regulator active and trigger core warnings.

> +	if (err)
> +		return dev_err_probe(&core->dev, err,
> +				     "error enabling VCC regulator");
>  
>  	switch (core->id.id) {
>  	case BCMA_CORE_USB20_HOST:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260920211356.186967-1-rosenp@gmail.com?part=2

      reply	other threads:[~2026-09-20 21:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 21:13 [PATCH 0/2] usb: bcma: control VBUS via a regulator Rosen Penev
2026-09-20 21:13 ` [PATCH 1/2] usb: bcma: control VBUS via a regulator instead of a GPIO Rosen Penev
2026-09-20 21:22   ` sashiko-bot
2026-09-21 18:32   ` Rafał Miłecki
2026-09-20 21:13 ` [PATCH 2/2] ARM: dts: broadcom: model USB VBUS power with regulator-fixed Rosen Penev
2026-09-20 21:27   ` sashiko-bot [this message]

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=20260920212715.6D5761F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rosenp@gmail.com \
    --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 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.