From: sashiko-bot@kernel.org
To: "Elson Serrao" <elson.serrao@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 5/9] usb: misc: qcom_eud: improve enable_store API
Date: Tue, 11 Aug 2026 21:56:07 +0000 [thread overview]
Message-ID: <20260811215608.3F4DA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811213610.2956147-6-elson.serrao@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] The early return optimization in `enable_store` causes a state desynchronization if the hardware was left enabled before probe (e.g., by the bootloader), preventing userspace from disabling it.
Pre-existing issues:
- [High] `pet_eud()` calls the sleeping function `readl_poll_timeout()` while executing in the top-half hardirq handler, which causes a kernel panic.
--
--- Patch [5]: [PATCH v6 5/9] usb: misc: qcom_eud: improve enable_store API ---
commit ba15c5168dac3d6c5421e3601396a69dd6a1abdb
Author: Elson Serrao <elson.serrao@oss.qualcomm.com>
usb: misc: qcom_eud: improve enable_store API
This commit adds duplicate state checks to skip redundant enable or disable
requests when the EUD is already in the desired state. It also adds explicit
error logging to provide better feedback.
> diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
> index 48a4441b0c9c0..e83a4402e4b84 100644
> --- a/drivers/usb/misc/qcom_eud.c
> +++ b/drivers/usb/misc/qcom_eud.c
> @@ -162,18 +162,27 @@ static ssize_t enable_store(struct device *dev,
> if (kstrtobool(buf, &enable))
> return -EINVAL;
>
> + /* Skip operation if already in desired state */
> + if (chip->enabled == enable)
> + return count;
> +
[Severity: High]
Does this early return risk a state desynchronization if the hardware was
left enabled before probe?
Since chip is allocated via devm_kzalloc(), chip->enabled initializes to false
without reading the actual hardware state. If the bootloader or a previous
instance leaves the EUD active, and a boot script subsequently writes '0' to
the sysfs enable attribute to explicitly disable it, this check will evaluate
to false == false and return immediately without actually disabling the
hardware.
[ ... ]
Additionally, while reviewing this file, I noticed a pre-existing issue in the
interrupt handling path:
drivers/usb/misc/qcom_eud.c:handle_eud_irq() {
...
case EUD_INT_SAFE_MODE:
pet_eud(chip);
return IRQ_HANDLED;
...
}
drivers/usb/misc/qcom_eud.c:pet_eud() {
...
ret = readl_poll_timeout(chip->base + EUD_REG_SW_ATTACH_DET,
reg, (reg == 0), 1, 100);
...
}
[Severity: High]
This isn't a bug introduced by this patch, but does pet_eud() call a sleeping
function while executing in a top-half hardirq context?
When the EUD_INT_SAFE_MODE interrupt is asserted, the primary IRQ handler
handle_eud_irq() is invoked in hardirq context. It calls pet_eud(), which
uses readl_poll_timeout() with a sleep_us parameter of 1. This invokes
usleep_range(), forcing a sleep in an atomic context and likely causing a
scheduling while atomic panic.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260811213610.2956147-1-elson.serrao@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-08-11 21:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 21:36 [PATCH v6 0/9] Improve Qualcomm EUD driver and platform support Elson Serrao
2026-08-11 21:36 ` [PATCH v6 1/9] dt-bindings: soc: qcom: eud: Add per-path child nodes for UTMI routing Elson Serrao
2026-08-11 21:50 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 2/9] usb: misc: qcom_eud: add sysfs attribute for port selection Elson Serrao
2026-08-11 21:54 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control Elson Serrao
2026-08-11 21:56 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 4/9] usb: misc: qcom_eud: add per-path role switch support Elson Serrao
2026-08-11 21:57 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 5/9] usb: misc: qcom_eud: improve enable_store API Elson Serrao
2026-08-11 21:56 ` sashiko-bot [this message]
2026-08-11 21:36 ` [PATCH v6 6/9] usb: misc: qcom_eud: add role-based EUD control Elson Serrao
2026-08-11 21:54 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 7/9] usb: misc: qcom_eud: fix virtual attach/detach event handling Elson Serrao
2026-08-11 22:00 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 8/9] arm64: dts: qcom: kodiak: Describe EUD UTMI path using child node Elson Serrao
2026-08-11 22:05 ` sashiko-bot
2026-08-11 21:36 ` [PATCH v6 9/9] arm64: dts: qcom: Map USB connector to EUD on Kodiak boards Elson Serrao
2026-08-11 22:06 ` 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=20260811215608.3F4DA1F000E9@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.