All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam via B4 Relay"
	<devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 7/9] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq
Date: Tue, 19 May 2026 11:30:09 +0000	[thread overview]
Message-ID: <20260519113010.17C9AC2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519-pwrseq-m2-bt-v3-7-b39dc2ae3966@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Resource leak due to `devm_pwrseq_get()` being tied to the parent UART controller device instead of the serdev device being probed.
--

commit cdecabb47fcbe744365c9b9d2fe977b061bcd9d4
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq

This commit adds support for controlling the power supply to an M.2 Bluetooth
device using the uart pwrseq device. It retrieves the pwrseq device if an
OF graph link is present on the controller device.

> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index cd1834246b479..c83fe72bc5499 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
[ ... ]
> @@ -2443,6 +2444,18 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  	case QCA_WCN6750:
>  	case QCA_WCN6855:
>  	case QCA_WCN7850:
> +		/*
> +		 * OF graph link is only present for BT devices attached through
> +		 * the M.2 Key E connector.
> +		 */
> +		if (of_graph_is_present(dev_of_node(&serdev->ctrl->dev))) {
> +			qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->ctrl->dev,
> +								   "uart");

Does this leak the pwrseq descriptor if the probe fails later or the driver
is unbound?

By passing &serdev->ctrl->dev to devm_pwrseq_get(), the devres cleanup
action is attached to the parent UART controller's lifecycle rather than the
Bluetooth serdev device (&serdev->dev) currently being probed.

If the driver probe fails in subsequent steps (like hci_uart_register_device),
the driver core cleans up devres allocations for &serdev->dev, but this
allocation would remain permanently attached to the still-active parent
&serdev->ctrl->dev device.

Could this cause multiple leaks and keep the provider's module reference
elevated during repeated probe deferrals or bind/unbind cycles?

> +			if (IS_ERR(qcadev->bt_power->pwrseq))
> +				return PTR_ERR(qcadev->bt_power->pwrseq);
> +			break;
> +		}
> +
>  		if (!device_property_present(&serdev->dev, "enable-gpios")) {
>  			/*
>  			 * Backward compatibility with old DT sources. If the

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260519-pwrseq-m2-bt-v3-0-b39dc2ae3966@oss.qualcomm.com?part=7

  reply	other threads:[~2026-05-19 11:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  8:55 [PATCH v3 0/9] Fixes/improvements for the PCI M.2 power sequencing driver Manivannan Sadhasivam
2026-05-19  8:55 ` Manivannan Sadhasivam via B4 Relay
2026-05-19  8:55 ` [PATCH v3 1/9] power: sequencing: pcie-m2: Fix inconsistent function prefixes Manivannan Sadhasivam
2026-05-19  8:55   ` Manivannan Sadhasivam via B4 Relay
2026-05-19 13:16   ` Fixes/improvements for the PCI M.2 power sequencing driver bluez.test.bot
2026-05-19  8:55 ` [PATCH v3 2/9] power: sequencing: pcie-m2: Allow creating serdev for multiple PCI devices Manivannan Sadhasivam
2026-05-19  8:55   ` Manivannan Sadhasivam via B4 Relay
2026-05-19  9:40   ` sashiko-bot
2026-05-19  8:55 ` [PATCH v3 3/9] power: sequencing: pcie-m2: Improve PCI device ID check Manivannan Sadhasivam
2026-05-19  8:55   ` Manivannan Sadhasivam via B4 Relay
2026-05-19  8:55 ` [PATCH v3 4/9] power: sequencing: pcie-m2: Create serdev for PCI devices present before probe Manivannan Sadhasivam
2026-05-19  8:55   ` Manivannan Sadhasivam via B4 Relay
2026-05-19 10:04   ` sashiko-bot
2026-05-19  8:56 ` [PATCH v3 5/9] power: sequencing: pcie-m2: Create BT node based on the pci_device_id[] table Manivannan Sadhasivam
2026-05-19  8:56   ` Manivannan Sadhasivam via B4 Relay
2026-05-19  8:56 ` [PATCH v3 6/9] power: sequencing: Add an API to return the pwrseq device's 'dev' pointer Manivannan Sadhasivam
2026-05-19  8:56   ` Manivannan Sadhasivam via B4 Relay
2026-05-19 10:45   ` sashiko-bot
2026-05-19  8:56 ` [PATCH v3 7/9] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq Manivannan Sadhasivam
2026-05-19  8:56   ` Manivannan Sadhasivam via B4 Relay
2026-05-19 11:30   ` sashiko-bot [this message]
2026-05-19  8:56 ` [PATCH v3 8/9] Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available' Manivannan Sadhasivam
2026-05-19  8:56   ` Manivannan Sadhasivam via B4 Relay
2026-05-19  8:56 ` [PATCH v3 9/9] Bluetooth: hci_qca: Set 'bt_en_available' based on W_DISABLE2# presence in M.2 connector Manivannan Sadhasivam
2026-05-19  8:56   ` Manivannan Sadhasivam via B4 Relay

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=20260519113010.17C9AC2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org \
    --cc=linux-pci@vger.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.