Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nabige Aala" <nabige.aala@oss.qualcomm.com>
Cc: neil.armstrong@linaro.org, olteanv@gmail.com,
	linux-phy@lists.infradead.org, vkoul@kernel.org
Subject: Re: [PATCH v4 9/9] phy: qualcomm: qmp-combo: Fix error propagation in qmp_combo_dp_power_on()
Date: Tue, 08 Sep 2026 14:44:05 +0000	[thread overview]
Message-ID: <20260908144405.DEAB91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908-glymur-phy-v3-v4-9-ff22e5150538@oss.qualcomm.com>

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

New issues:
- [High] Propagating the error from `cfg->configure_dp_phy()` bypasses the framework's cleanup, leaving the DP PHY hardware partially powered on indefinitely.

Pre-existing issues:
- [High] The identical bug (ignoring `configure_dp_phy()` error) exists in the sibling driver `phy-qcom-qmp-usbc.c` and was missed by this patch.
- [High] Ignored failure of `qmp_combo_com_init()` in Type-C multiplexing logic leads to unclocked register access and kernel panic.
--

commit cba00203ff9ff2a7508310091ad676a9c5ba878e
Author: Nabige Aala <nabige.aala@oss.qualcomm.com>

phy: qualcomm: qmp-combo: Fix error propagation in qmp_combo_dp_power_on()

This commit modifies qmp_combo_dp_power_on() to capture and propagate
errors from the configure_dp_phy() callback instead of silently ignoring
them. On failure, it also skips setting the dp_powered_on flag and
returns the error to the caller.

> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index bb1c5df52d095..d77fe94b312cb 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c

[ ... ]

> @@ -4328,13 +4329,17 @@ static int qmp_combo_dp_power_on(struct phy *phy)
>  	cfg->configure_dp_tx(qmp);
>  
>  	/* Configure link rate, swing, etc. */
> -	cfg->configure_dp_phy(qmp);
> +	ret = cfg->configure_dp_phy(qmp);
> +	if (ret) {
> +		dev_err(qmp->dev, "DP PHY configuration failed: %d\n", ret);
> +		goto out_unlock;

[Severity: High]
Does propagating the error directly to the caller leave the DP PHY hardware
partially powered on indefinitely?

Earlier in this flow, the DP PHY block is brought out of power-down by
setting the active bits in QSERDES_DP_PHY_PD_CTL. Because the PHY core
framework treats a failure here as a failed power-on, it will never invoke
qmp_combo_dp_power_off() to restore the power-down state.

Could this error path assert DP_PHY_PD_CTL_PSR_PWRDN before returning to
prevent a power leak and undefined hardware state?

> +	}
>  
>  	qmp->dp_powered_on = true;
>  
> +out_unlock:
>  	mutex_unlock(&qmp->phy_mutex);
> -
> -	return 0;
> +	return ret;
>  }

[Severity: High]
This is a pre-existing issue, but does the identical bug exist in the
sibling driver?

Looking at qmp_usbc_dp_power_on() in drivers/phy/qualcomm/phy-qcom-qmp-usbc.c,
it shares the same initialization flow but unconditionally returns 0:

    /* Configure link rate, swing, etc. */
    cfg->configure_dp_phy(qmp);

    mutex_unlock(&qmp->phy_mutex);

    return 0;

If configure_dp_phy() fails, the framework is falsely informed that the PHY
is successfully powered on, which will cause the display subsystem to
silently fail during link training. Should a similar fix be applied there
for consistency?

[Severity: High]
This is a pre-existing issue, but does the Type-C multiplexing logic ignore
initialization failures?

In qmp_combo_typec_switch_set(), the code calls qmp_combo_com_init() to
enable PHY clocks and regulators:

        qmp_combo_com_exit(qmp, true);

        qmp_combo_com_init(qmp, true);
        if (qmp->usb_init_count)
            qmp_combo_usb_power_on(qmp->usb_phy);

If enabling clocks or regulators fails, the code proceeds to call
qmp_combo_usb_power_on() and cfg->dp_aux_init() which perform MMIO writes.

Can accessing unclocked or unpowered peripheral registers on these platforms
trigger a synchronous external abort and kernel panic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-glymur-phy-v3-v4-0-ff22e5150538@oss.qualcomm.com?part=9

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

  reply	other threads:[~2026-09-08 14:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 14:00 [PATCH v4 0/9] phy: qualcomm: qmp-combo: update DP PHY PLL programming on Glymur Nabige Aala
2026-09-08 14:00 ` [PATCH v4 1/9] phy: qualcomm: qmp-combo: Add DP COM v8 header and fix register layout Nabige Aala
2026-09-08 14:30   ` sashiko-bot
2026-09-08 14:00 ` [PATCH v4 2/9] phy: qualcomm: qmp-combo: Update DP PHY common init tables Nabige Aala
2026-09-08 14:00 ` [PATCH v4 3/9] phy: qualcomm: qmp-combo: Update link rate specific DP PHY tables Nabige Aala
2026-09-08 14:00 ` [PATCH v4 4/9] phy: qualcomm: qmp-combo: Add hardware-specific DP PHY config fields Nabige Aala
2026-09-08 14:16   ` sashiko-bot
2026-09-11  5:25   ` Manivannan Sadhasivam
2026-09-08 14:00 ` [PATCH v4 5/9] phy: qualcomm: qmp-combo: Add v8 PCS-level drive level tables for Glymur Nabige Aala
2026-09-11  5:27   ` Manivannan Sadhasivam
2026-09-08 14:00 ` [PATCH v4 6/9] phy: qualcomm: qmp-combo: Extract common DP PHY init sequence Nabige Aala
2026-09-11  5:30   ` Manivannan Sadhasivam
2026-09-11 12:25     ` Nabige Aala
2026-09-08 14:01 ` [PATCH v4 7/9] phy: qualcomm: qmp-combo: Update qmp_v8_configure_dp_clocks() for Glymur Nabige Aala
2026-09-08 14:26   ` sashiko-bot
2026-09-11  5:37   ` Manivannan Sadhasivam
2026-09-08 14:01 ` [PATCH v4 8/9] phy: qualcomm: qmp-combo: Fix Glymur v8 DP PHY init and configure sequences Nabige Aala
2026-09-11  5:38   ` Manivannan Sadhasivam
2026-09-08 14:01 ` [PATCH v4 9/9] phy: qualcomm: qmp-combo: Fix error propagation in qmp_combo_dp_power_on() Nabige Aala
2026-09-08 14:44   ` sashiko-bot [this message]
2026-09-11  5:39   ` Manivannan Sadhasivam

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=20260908144405.DEAB91F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=nabige.aala@oss.qualcomm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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