Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sven Peter" <sven@kernel.org>
Cc: neil.armstrong@linaro.org, olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org
Subject: Re: [PATCH 1/3] phy: apple: atc: Support DUMMY PIPEHANDLER state in configure_pipehandler
Date: Fri, 21 Aug 2026 14:01:14 +0000	[thread overview]
Message-ID: <20260821140114.960CF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821-b4-atcphy-usb4-v1-1-45c0b741e0c0@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] `atcphy->pipehandler_up` is unconditionally set to true even if `atcphy_configure_pipehandler_usb3()` fails, masking errors on subsequent configuration attempts.
--

--- Patch [1]: [PATCH 1/3] phy: apple: atc: Support DUMMY PIPEHANDLER state in configure_pipehandler ---
commit 969f2e11a2c1dceb64c1ff0f1f1da36afa041518
Author: Sven Peter <sven@kernel.org>

phy: apple: atc: Support DUMMY PIPEHANDLER state in configure_pipehandler

For both Thunderbolt and DisplayPort atcphy_configure_pipehandler is
reached with a request to switch to the DUMMY state (i.e. usb2 only).
This actually handles that case correctly and drops the default from
the switch to enable compiler warnings for missing pipehandler states.

Closes: https://github.com/AsahiLinux/linux/pull/515
Fixes: 8e98ca1e74db ("phy: apple: Add Apple Type-C PHY")

> diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
> index 4156fabad742c..a3162f25e6cd6 100644
> --- a/drivers/phy/apple/atc.c
> +++ b/drivers/phy/apple/atc.c
> @@ -1121,7 +1121,7 @@ static int atcphy_configure_pipehandler_dummy(struct apple_atcphy *atcphy)
>  
>  static int atcphy_configure_pipehandler(struct apple_atcphy *atcphy, bool host)
>  {
> -	int ret;
> +	int ret = -EINVAL;
>  
>  	lockdep_assert_held(&atcphy->lock);
>  

[Severity: High]
This isn't a bug introduced by this patch, but looking at the USB3 state
handling in atcphy_configure_pipehandler() just below this:

drivers/phy/apple/atc.c:atcphy_configure_pipehandler() {
    ...
	case ATCPHY_PIPEHANDLER_STATE_USB3:
		ret = atcphy_configure_pipehandler_usb3(atcphy, host);
		atcphy->pipehandler_up = true;
		break;
    ...
}

Is it safe to unconditionally set atcphy->pipehandler_up to true even if
atcphy_configure_pipehandler_usb3() fails?

If the USB3 PHY initialization fails (for example, due to a lock timeout or
BIST failure), the PHY is not correctly configured but the state is still
marked as up.

Could this cause subsequent mode setting attempts (like from the generic
xHCI code) to falsely return success without re-attempting configuration,
leaving the USB port permanently broken?

[ ... ]

> @@ -1136,8 +1136,10 @@ static int atcphy_configure_pipehandler(struct apple_atcphy *atcphy, bool host)
>  		ret = atcphy_configure_pipehandler_dummy(atcphy);
>  		atcphy->pipehandler_up = false;
>  		break;
> -	default:
> -		ret = -EINVAL;
> +	case ATCPHY_PIPEHANDLER_STATE_DUMMY:
> +		ret = atcphy_configure_pipehandler_dummy(atcphy);
> +		atcphy->pipehandler_up = false;
> +		break;
>  	}
>  
>  	return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260821-b4-atcphy-usb4-v1-0-45c0b741e0c0@kernel.org?part=1

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-08-21 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 13:50 [PATCH 0/3] phy: apple: atc: Prepare USB3-via-4 tunneling Sven Peter
2026-08-21 13:50 ` [PATCH 1/3] phy: apple: atc: Support DUMMY PIPEHANDLER state in configure_pipehandler Sven Peter
2026-08-21 14:01   ` sashiko-bot [this message]
2026-08-21 13:50 ` [PATCH 2/3] phy: apple: atc: Factor out the PIPE mux sequence Sven Peter
2026-08-21 13:50 ` [PATCH 3/3] phy: apple: atc: Implement the USB4 pipehandler state Sven Peter
2026-08-21 14:01   ` sashiko-bot
2026-08-21 14:05     ` Sven Peter

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=20260821140114.960CF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sven@kernel.org \
    --cc=vkoul@kernel.org \
    /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