Re: [PATCH v8 2/8] usb: misc: qcom_eud: add sysfs attribute for port selection
From: sashiko-bot@kernel.org
Date: 2026-09-12 23:02:14
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `chip->port_idx` state variable is not initialized from the hardware register on probe, potentially desynchronizing from the actual hardware state. -- commit ff68b261929b924c0854c25143a07864641e767b Author: Elson Serrao [off-list ref] usb: misc: qcom_eud: add sysfs attribute for port selection EUD can be mapped to either the primary USB port or the secondary USB port depending on the value of the EUD_PORT_SEL register. Add a 'port' sysfs attribute to allow userspace to select which port EUD should operate on and update the ABI documentation.
quoted hunk ↗ jump to hunk
diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c index 926419ca560fc..25a6a8f110ec8 100644 --- a/drivers/usb/misc/qcom_eud.c +++ b/drivers/usb/misc/qcom_eud.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -104,8 +113,38 @@ static ssize_t enable_store(struct device *dev, static DEVICE_ATTR_RW(enable); +static ssize_t port_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct eud_chip *chip = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%s\n", eud_port_names[chip->port_idx]);
[Severity: Medium]
Will this report a stale default value ("primary") instead of the true hardware
state if the EUD_REG_PORT_SEL register was modified prior to driver probe?
Because chip->port_idx defaults to 0 and isn't synchronized with the hardware
register in eud_probe() (either by reading it or resetting it to 0), the driver
could report the primary port while the hardware is actually routing EUD to the
secondary port.
This can happen if the user switches to the secondary port and the driver module
is unloaded and reloaded, or if the bootloader left the hardware operating on
the secondary port.
When EUD is subsequently enabled, the driver would then power on the PHY for
the primary port instead of the secondary port, breaking the connection.
+} + +static ssize_t port_store(struct device *dev, struct device_attribute *attr,
-- Sashiko AI review · https://sashiko.dev/#/patchset/20260912225301.3396556-1-elson.serrao@oss.qualcomm.com?part=2