All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/4] power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
Date: Sun, 22 Nov 2026 07:00:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-227775@kernel.org> (raw)
In-Reply-To: <20261122-pcie6_fix-v2-2-2e0fe615d90b@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] power: sequencing: pcie-m2: regulator leak on GPIO error in
  pwrseq_pcie_m2_probe()
- [Low] power: sequencing: pcie-m2: missing GPIO rollback in
  pwrseq_pci_m2_b_pcie_enable()
--

commit 7e388f1a5a5b0e7dcbfd3500f89d85602dad1287
Author: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>

power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors

This commit adds power sequencing support for PCIe M.2 Key B connectors,
handling the power supplies along with the FULL_CARD_POWER_OFF#, RESET#,
and W_DISABLE1# GPIOs.

> diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
> index 56c5d51293c10..8af4a059b5961 100644
> --- a/drivers/power/sequencing/pwrseq-pcie-m2.c
> +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
[ ... ]
> @@ -135,6 +137,45 @@ static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = {
>  	.disable = pwrseq_pci_m2_e_pcie_disable,
>  };
>  
> +static int pwrseq_pci_m2_b_pcie_enable(struct pwrseq_device *pwrseq)
> +{
> +	struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
> +	int ret;
> +
> +	ret = gpiod_set_value_cansleep(ctx->full_card_power_off_gpio, 0);
> +	if (ret)
> +		return ret;
> +
> +	ret = gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> +	if (ret)
> +		return ret;
> +
> +	return gpiod_set_value_cansleep(ctx->w_disable1_gpio, 0);
> +}

[Severity: Low]
If gpiod_set_value_cansleep() fails on ctx->reset_gpio or
ctx->w_disable1_gpio, should this restore the earlier GPIOs back to 1
before returning?

When unit->enable() fails, pwrseq_unit_enable() disables the regulator
dependency units without calling unit->disable(), leaving
ctx->full_card_power_off_gpio (and ctx->reset_gpio) deasserted while
power is off.

[ ... ]

> @@ -577,6 +632,17 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev)
>  		goto err_free_regulators;
>  	}
>  
> +	ctx->full_card_power_off_gpio = devm_gpiod_get_optional(dev, "full-card-power-off",
> +								 GPIOD_OUT_HIGH);
> +	if (IS_ERR(ctx->full_card_power_off_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->full_card_power_off_gpio),
> +				     "Failed to get the FULL_CARD_POWER_OFF# GPIO\n");
> +
> +	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> +	if (IS_ERR(ctx->reset_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
> +				     "Failed to get the RESET# GPIO\n");
> +

[Severity: Medium]
Do these error paths leak ctx->regs and the regulator references acquired
by of_regulator_bulk_get_all()?

Unlike the w_disable1_gpio and w_disable2_gpio checks right above,
returning directly here bypasses the err_free_regulators label that calls
regulator_bulk_free() and kfree(ctx->regs).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261122-pcie6_fix-v2-0-2e0fe615d90b@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-22  7:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  6:45 [PATCH v2 0/4] power: sequencing: pcie-m2: Add PCIe M.2 Key B connector support Krishna Chaitanya Chundru
2026-11-22  6:45 ` [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector Krishna Chaitanya Chundru
2026-11-23 10:04   ` Alexey Charkov
2026-11-23 17:48     ` Rob Herring
2026-11-23 15:11   ` Rob Herring (Arm)
2026-11-23 17:54   ` Rob Herring
2026-11-22  6:45 ` [PATCH v2 2/4] power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors Krishna Chaitanya Chundru
2026-11-22  7:00   ` sashiko-bot [this message]
2026-11-23 10:12   ` Alexey Charkov
2026-11-22  6:45 ` [PATCH v2 3/4] arm64: dts: qcom: glymur-crd: Describe the PCIe M.2 Key B connector Krishna Chaitanya Chundru
2026-11-25 11:13   ` Konrad Dybcio
2026-11-22  6:45 ` [PATCH v2 4/4] arm64: dts: qcom: nord-rrd: " Krishna Chaitanya Chundru
2026-11-22  7:00 ` [PATCH v2 0/4] power: sequencing: pcie-m2: Add PCIe M.2 Key B connector support sashiko-bot

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-227775@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krishna.chundru@oss.qualcomm.com \
    --cc=linux-pci@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.