Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Elson Serrao" <elson.serrao@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, vkoul@kernel.org,
	neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH] phy: qcom: qmp-combo: Fix AON toggle register presence check
Date: Wed, 02 Dec 2026 04:52:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-244865@kernel.org> (raw)
In-Reply-To: <20261202044831.3528405-1-elson.serrao@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] phy: qcom-qmp-combo: reference count corruption in
  qmp_combo_com_init() [1]
--

commit dccf447e1e62578f09efd8227671a2f8922cab99
Author: Elson Serrao <elson.serrao@oss.qualcomm.com>

phy: qcom: qmp-combo: Fix AON toggle register presence check

This commit adds a has_aon_toggle flag to struct qmp_phy_cfg to indicate
the presence of AON toggle registers instead of checking the register
offset, which can be 0x00 on V10 PHYs, and renames the aon_toggle mapping
to com_aon.

> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 3acf28c7d7b21..35fcf8681c627 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c

[ ... ]

> @@ -4095,17 +4098,17 @@ static int qmp_combo_com_init(struct qmp_combo *qmp, bool force)
>  	void __iomem *pcs_aon = qmp->pcs_aon;
>  	void __iomem *pcs = qmp->pcs;
>  	void __iomem *com = qmp->com;
> -	void __iomem *aon_toggle;
> +	void __iomem *aon_base;
>  	int ret;
>  	u32 val;
>  
>  	if (!force && qmp->init_count++)
>  		return 0;

[Severity: High]
This problem wasn't introduced by this patch, but can qmp->init_count
become unbalanced in qmp_combo_com_init() [1] when force is true?

When force is true, qmp->init_count++ is skipped on entry, but if
regulator_bulk_enable(), reset control, or clock enabling fails, the
err_decrement_count path unconditionally decrements qmp->init_count:

drivers/phy/qualcomm/phy-qcom-qmp-combo.c:qmp_combo_com_init() {
	...
	ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
	if (ret) {
		dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);
		goto err_decrement_count;
	}
	...
err_decrement_count:
	qmp->init_count--;

	return ret;
}

Later calls to qmp_combo_com_exit() can then see a corrupted init_count
and disable regulators and clocks that are already disabled.

[1] https://sashiko.dev/#/bug/linux-10d6c507-1390-4fe5-8fd5-650aea6f4e69

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

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

      reply	other threads:[~2026-12-02  4:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  4:48 [PATCH] phy: qcom: qmp-combo: Fix AON toggle register presence check Elson Serrao
2026-12-02  4:52 ` 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=sashiko-outbox-244865@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=elson.serrao@oss.qualcomm.com \
    --cc=linux-phy@lists.infradead.org \
    --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