From: sashiko-bot@kernel.org
To: "Fabrice Gasnier" <fabrice.gasnier@foss.st.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: mux: gpio-sbu: enable when only used for orientation
Date: Wed, 26 Aug 2026 10:03:33 +0000 [thread overview]
Message-ID: <20260826100333.E46FA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826-usb-fusb340-v1-v2-2-994a03c9ae45@foss.st.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The `mode-switch` property is probed after registering the Type-C switch, contradicting the v2 commit message and introducing a race condition where incoming callbacks might use uninitialized state.
--
commit c810037786c450b0d450c67a1bf5b0c47390d167
Author: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
usb: typec: mux: gpio-sbu: enable when only used for orientation
This commit modifies the GPIO SBU mux driver to enable the optional GPIO
when used purely as an orientation switch. It adds logic to check the
mode-switch property and adjust the GPIO state accordingly in the switch_set
callback.
> diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
> index 1834f1a2dd9dd..120f1ab5dbcb3 100644
> --- a/drivers/usb/typec/mux/gpio-sbu-mux.c
> +++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
> @@ -40,19 +41,24 @@ static int gpio_sbu_switch_set(struct typec_switch_dev *sw,
> enabled = false;
> break;
> case TYPEC_ORIENTATION_NORMAL:
> + if (!sbu_mux->mode_switch)
> + enabled = true;
> swapped = false;
> break;
[ ... ]
> @@ -125,6 +131,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(sbu_mux->sw),
> "failed to register typec switch\n");
>
> + sbu_mux->mode_switch = device_property_read_bool(dev, "mode-switch");
> +
> mux_desc.drvdata = sbu_mux;
[Severity: High]
Can this registration order introduce a regression where incoming callbacks
use uninitialized state?
If a Type-C switch event occurs immediately after typec_switch_register()
returns but before device_property_read_bool() executes, could the
gpio_sbu_switch_set() callback incorrectly evaluate sbu_mux->mode_switch as
false? The memory for sbu_mux is zeroed by devm_kzalloc, which might cause
the enable GPIO to be incorrectly asserted during this initialization window.
Additionally, the patch description mentions probing the mode-switch property
before registering the Type-C switch to avoid a race condition. Should this
property read be moved above the typec_switch_register() call to prevent
this issue?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826-usb-fusb340-v1-v2-0-994a03c9ae45@foss.st.com?part=2
prev parent reply other threads:[~2026-08-26 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 9:53 [PATCH v2 0/2] usb: gpio-sbu-mux: add FUSB340 and enable option for orientation Fabrice Gasnier
2026-08-26 9:53 ` [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Add compatible for FUSB340 Fabrice Gasnier
2026-08-26 9:53 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: enable when only used for orientation Fabrice Gasnier
2026-08-26 10:02 ` Fabrice Gasnier
2026-08-26 10:03 ` sashiko-bot [this message]
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=20260826100333.E46FA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@foss.st.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