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, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v9 5/8] usb: misc: qcom_eud: improve enable_store API
Date: Tue, 29 Sep 2026 21:43:04 +0000	[thread overview]
Message-ID: <20260929214304.E1BDF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929213513.2401005-6-elson.serrao@oss.qualcomm.com>

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?

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.

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

  reply	other threads:[~2026-09-29 21:43 UTC|newest]

Thread overview: 15+ 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 [this message]
2026-09-29 22:45     ` Elson Serrao
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-13 11:01   ` Konrad Dybcio
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=20260929214304.E1BDF1F000FF@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.