All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Elson Serrao" <elson.serrao@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v8 6/8] usb: misc: qcom_eud: add role-based EUD control
Date: Sat, 12 Sep 2026 23:03:04 +0000	[thread overview]
Message-ID: <20260912230304.A0EBD1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912225301.3396556-7-elson.serrao@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Mixing goto-based exit logic with scope-based guard() cleanup in `handle_eud_irq_thread`.
--

commit 5bca652d5a5a406c9aee75922062a73bc36dc72b
Author: Elson Serrao <elson.serrao@oss.qualcomm.com>

usb: misc: qcom_eud: add role-based EUD control

This commit updates the QCOM EUD driver to only operate when the port is in
device role, preserving hardware resources and preventing controller misbehavior
in host role. It uses a mutex to serialize state management across sysfs, IRQ,
and role switch paths.

> diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
> --- a/drivers/usb/misc/qcom_eud.c
> +++ b/drivers/usb/misc/qcom_eud.c
[ ... ]
> @@ -285,8 +306,13 @@ static irqreturn_t handle_eud_irq_thread(int irq, void *data)
>  	struct eud_path *path;
>  	int ret;
>  
> +	guard(mutex)(&chip->state_lock);
> +
>  	path = chip->paths[chip->port_idx];
>  
> +	if (!chip->enabled || path->curr_role != USB_ROLE_DEVICE)
> +		goto out;
> +

[Severity: Low]
Does this code mix a goto-based exit label (out) with a scope-based
guard(mutex) in handle_eud_irq_thread()?

The Cleanup and Guard Subsystem architectural guidelines explicitly ban mixing
these patterns in the same function to prevent confusing ownership semantics.
While this might not lead to an immediate runtime failure here since the goto
just skips to clearing an interrupt and returning, the subsystem documentation
states that for a given routine, all resources must either be converted to
scope-based cleanup, or none of them should be.

>  	if (chip->usb_attached)
>  		ret = usb_role_switch_set_role(path->controller_sw, USB_ROLE_DEVICE);
>  	else
> @@ -294,6 +320,7 @@ static irqreturn_t handle_eud_irq_thread(int irq, void *data)
>  	if (ret)
>  		dev_err(chip->dev, "failed to set role switch\n");
>  
> +out:
>  	/* set and clear vbus_int_clr[0] to clear interrupt */
>  	writel(BIT(0), chip->base + EUD_REG_VBUS_INT_CLR);
>  	writel(0, chip->base + EUD_REG_VBUS_INT_CLR);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912225301.3396556-1-elson.serrao@oss.qualcomm.com?part=6

  reply	other threads:[~2026-09-12 23:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 22:52 [PATCH v8 0/8] Improve Qualcomm EUD driver and platform support Elson Serrao
2026-09-12 22:52 ` [PATCH v8 1/8] dt-bindings: soc: qcom: eud: Add per-path child nodes for UTMI routing Elson Serrao
2026-09-12 22:52 ` [PATCH v8 2/8] usb: misc: qcom_eud: add sysfs attribute for port selection Elson Serrao
2026-09-12 23:02   ` sashiko-bot
2026-09-12 22:52 ` [PATCH v8 3/8] usb: misc: qcom_eud: add per-path High-Speed PHY control Elson Serrao
2026-09-12 23:16   ` sashiko-bot
2026-09-12 22:52 ` [PATCH v8 4/8] usb: misc: qcom_eud: add per-path role switch support Elson Serrao
2026-09-12 23:08   ` sashiko-bot
2026-09-12 22:52 ` [PATCH v8 5/8] usb: misc: qcom_eud: improve enable_store API Elson Serrao
2026-09-12 22:52 ` [PATCH v8 6/8] usb: misc: qcom_eud: add role-based EUD control Elson Serrao
2026-09-12 23:03   ` sashiko-bot [this message]
2026-09-12 22:53 ` [PATCH v8 7/8] usb: misc: qcom_eud: fix virtual attach/detach event handling Elson Serrao
2026-09-12 23:12   ` sashiko-bot
2026-09-12 22:53 ` [PATCH v8 8/8] arm64: dts: qcom: kodiak: Desribe EUD UTMI routing and connector mapping Elson Serrao
2026-09-12 23:11   ` sashiko-bot

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=20260912230304.A0EBD1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=elson.serrao@oss.qualcomm.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 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.