From: Elson Serrao <elson.serrao@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: Re: [PATCH v9 5/8] usb: misc: qcom_eud: improve enable_store API
Date: Tue, 29 Sep 2026 15:45:45 -0700 [thread overview]
Message-ID: <547e3087-cf24-4071-a9e1-5740113fe613@oss.qualcomm.com> (raw)
In-Reply-To: <20260929214304.E1BDF1F000FF@smtp.kernel.org>
On 9/29/2026 2:43 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] usb: qcom_eud: uninitialized software state blocks disabling EUD on boot
> --
>
> commit 16556b4a5664eacf6eb75fc1fe5031d31c087dc0
> Author: Elson Serrao <elson.serrao@oss.qualcomm.com>
>
> usb: misc: qcom_eud: improve enable_store API
>
> This commit adds a state check in enable_store() to skip redundant hardware
> operations when the EUD is already in the desired state. It also improves
> error handling and logging when enabling or disabling the EUD.
>
>> diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
>> index 48e474bdf818c..e227d05cfecd4 100644
>> --- a/drivers/usb/misc/qcom_eud.c
>> +++ b/drivers/usb/misc/qcom_eud.c
> [ ... ]
>> @@ -164,18 +164,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: Medium]
> Will this early exit prevent users from disabling the hardware if the
> bootloader left the EUD enabled?
>
A bootloader-enabled EUD has never been supported; the driver has
always assumed EUD is disabled at probe. Supporting it would need more
than syncing chip->enabled from the register. The driver would also have
to take the PHY votes and bring the role-switch state into line for the
active path. That is a separate feature and outside the scope of this
series.
Thanks
Elson
> Since eud_probe() initializes chip->enabled to false (typically via
> devm_kzalloc), it does not verify or synchronize the software state with
> the actual hardware state by reading the hardware control registers (e.g.,
> EUD_REG_CSR_EUD_EN).
>
> If the bootloader leaves the EUD enabled, the hardware is active but
> chip->enabled is false.
>
> If a user then writes 0 to the sysfs attribute to explicitly disable the
> EUD, this check evaluates to true (false == false) and returns early.
>
> This bypasses the disable_eud() hardware routine, preventing the hardware
> from being disabled and potentially impacting power consumption or role
> switching.
>
next prev parent reply other threads:[~2026-09-29 22:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 21:35 [PATCH v9 0/8] Improve Qualcomm EUD driver and platform support Elson Serrao
2026-09-29 21:35 ` [PATCH v9 1/8] dt-bindings: soc: qcom: eud: Add per-path child nodes for UTMI routing Elson Serrao
2026-09-29 21:35 ` [PATCH v9 2/8] usb: misc: qcom_eud: add sysfs attribute for port selection Elson Serrao
2026-09-29 21:35 ` [PATCH v9 3/8] usb: misc: qcom_eud: add per-path High-Speed PHY control Elson Serrao
2026-09-29 21:35 ` [PATCH v9 4/8] usb: misc: qcom_eud: add per-path role switch support Elson Serrao
2026-09-29 21:35 ` [PATCH v9 5/8] usb: misc: qcom_eud: improve enable_store API Elson Serrao
2026-09-29 21:43 ` sashiko-bot
2026-09-29 22:45 ` Elson Serrao [this message]
2026-09-29 21:35 ` [PATCH v9 6/8] usb: misc: qcom_eud: add role-based EUD control Elson Serrao
2026-09-29 21:47 ` sashiko-bot
2026-09-29 22:48 ` Elson Serrao
2026-09-29 21:35 ` [PATCH v9 7/8] usb: misc: qcom_eud: fix virtual attach/detach event handling Elson Serrao
2026-09-29 21:35 ` [PATCH v9 8/8] arm64: dts: qcom: kodiak: Desribe EUD UTMI routing and connector mapping Elson Serrao
2026-10-07 10:44 ` [PATCH v9 0/8] Improve Qualcomm EUD driver and platform support Gopikrishna Garmidi
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=547e3087-cf24-4071-a9e1-5740113fe613@oss.qualcomm.com \
--to=elson.serrao@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox