From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <manivannan.sadhasivam@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface
Date: Mon, 30 Nov 2026 12:36:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-241071@kernel.org> (raw)
In-Reply-To: <20261130-pci-m2-bt-rework-v2-3-922fcad88987@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] Bluetooth: hci_qca: NULL dereference in qca_dmp_hdr() for
auxdev BT
- [High] Bluetooth: missing PM and coredump callbacks on M.2 BT aux
drivers
--
commit 3ab5a82ac78c3700161daeb1af994b0a9fc5fbdf
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface
This commit replaces runtime OF node creation for PCIe M.2 Bluetooth
interfaces with an auxiliary device carrying the serdev transport and
power sequencing target.
> diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
> index 56c5d51293c10..3ff21fa33e3e5 100644
> --- a/drivers/power/sequencing/pwrseq-pcie-m2.c
> +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
[ ... ]
> +static int pwrseq_pcie_m2_create_bt_aux(struct pwrseq_pcie_m2_ctx *ctx,
> struct pwrseq_pci_dev *pci_dev,
> - struct device_node *parent,
> struct pci_dev *pdev)
> {
> const struct pci_device_id *id;
> struct device *dev = ctx->dev;
> - const char *compatible;
> - struct device_node *np;
> + struct pcie_m2_bt_auxdev *bt;
> int ret;
>
> id = pci_match_id(pwrseq_m2_pci_ids, pdev);
> if (WARN_ON_ONCE(!id)) /* Shouldn't happen */
> return -ENODEV;
>
> - compatible = (const char *)id->driver_data;
> -
> - pci_dev->ocs = kzalloc_obj(*pci_dev->ocs);
> - if (!pci_dev->ocs)
> + bt = kzalloc_obj(*bt);
> + if (!bt)
> return -ENOMEM;
>
> - of_changeset_init(pci_dev->ocs);
> + ret = ida_alloc(&pwrseq_pcie_m2_bt_ida, GFP_KERNEL);
> + if (ret < 0)
> + goto err_free_bt;
>
> - np = of_changeset_create_node(pci_dev->ocs, parent, "bluetooth");
> - if (!np) {
> - dev_err(dev, "Failed to create bluetooth node\n");
> - ret = -ENODEV;
> - goto err_destroy_changeset;
> - }
> + bt->serdev = pci_dev->serdev;
> + bt->pwrseq_target = "uart";
> + bt->adev.id = ret;
> + bt->adev.name = (const char *)id->driver_data;
> + bt->adev.dev.parent = dev;
> + bt->adev.dev.release = pwrseq_pcie_m2_bt_release;
>
> - ret = of_changeset_add_prop_string(pci_dev->ocs, np, "compatible", compatible);
> - if (ret) {
> - dev_err(dev, "Failed to add bluetooth compatible: %d\n", ret);
> - goto err_destroy_changeset;
> - }
> + ret = auxiliary_device_init(&bt->adev);
> + if (ret)
> + goto err_free_ida;
>
> - ret = of_changeset_apply(pci_dev->ocs);
> + ret = auxiliary_device_add(&bt->adev);
[Severity: High]
Does moving driver binding from pci_dev->serdev->dev to bt->adev drop
the system PM and device coredump callbacks for Qualcomm and NXP M.2
Bluetooth controllers?
Previously, qca_serdev_driver (.pm = &qca_pm_ops, .coredump =
hciqca_coredump) or nxp_serdev_driver (.pm = &nxp_pm_ops, .coredump =
nxp_serdev_coredump) bound directly to pci_dev->serdev->dev. With this
change, pci_dev->serdev->dev stays unbound and the device binds to
qca_bt_aux_driver or nxp_bt_aux_driver instead, neither of which sets
.driver.pm or .driver.coredump (and qca_suspend(), qca_resume(), and
hciqca_coredump() also expect a struct serdev_device). As a regression,
system suspend/resume and sysfs coredump callbacks no longer run for
these controllers.
[ ... ]
> @@ -333,17 +351,17 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx,
> goto err_free_pci_dev;
> }
>
> - ret = pwrseq_pcie_m2_create_bt_node(ctx, pci_dev, serdev_parent, pdev);
> - if (ret)
> - goto err_free_serdev;
> -
> ret = serdev_device_add(pci_dev->serdev);
> if (ret) {
> dev_err(dev, "Failed to add serdev for PCI device (%s): %d\n",
> pci_name(pdev), ret);
> - goto err_free_dt_node;
> + goto err_free_serdev;
> }
>
> + ret = pwrseq_pcie_m2_create_bt_aux(ctx, pci_dev, pdev);
[Severity: High]
Can registering pci_dev->serdev without a bound serdev driver cause a
NULL pointer dereference in qca_dmp_hdr() during firmware crash dumps?
Without an OF node on pci_dev->serdev->dev, no serdev_device_driver binds
to it, leaving pci_dev->serdev->dev.driver NULL when qca_bt_aux_probe()
stores serdev in qcadev->serdev_hu.serdev. When a controller memory dump
is collected, qca_dmp_hdr() dereferences hu->serdev->dev.driver:
drivers/bluetooth/hci_qca.c:qca_dmp_hdr() {
...
snprintf(buf, sizeof(buf), "Driver: %s\n",
hu->serdev ? hu->serdev->dev.driver->name : "hci_ldisc_qca");
...
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-pci-m2-bt-rework-v2-0-922fcad88987@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-11-30 12:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-11-30 12:38 ` sashiko-bot
2026-11-30 12:49 ` Loic Poulain
2026-11-30 12:19 ` [PATCH v2 2/5] Bluetooth: btnxpuart: " Manivannan Sadhasivam via B4 Relay
2026-11-30 12:36 ` sashiko-bot
2026-11-30 12:19 ` [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface Manivannan Sadhasivam via B4 Relay
2026-11-30 12:36 ` sashiko-bot [this message]
2026-11-30 12:19 ` [PATCH v2 4/5] Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 5/5] Bluetooth: btnxpuart: " Manivannan Sadhasivam via B4 Relay
2026-11-30 12:38 ` [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus 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-241071@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox