From: sashiko-bot@kernel.org
To: "Loic Poulain" <loic.poulain@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 08/10] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval
Date: Fri, 31 Jul 2026 16:01:25 +0000 [thread overview]
Message-ID: <20260731160125.AC1351F00ACF@smtp.kernel.org> (raw)
In-Reply-To: <20260730-block-as-nvmem-v9-8-f72935817dbf@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Fetching NVMEM cells asynchronously in `hci_dev_setup_sync()` bypasses the kernel's probe deferral mechanism, causing non-deterministic hardware initialization failures.
--
--- Patch [8]: [PATCH v9 08/10] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval ---
commit 72e4410658718fb2db8f711db8f8fe59033dd650
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>
Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval
This commit adds support for retrieving the Bluetooth BD address from an
NVMEM cell when an in-chip address is not present. It introduces two new
quirks to indicate when to use the NVMEM address and its endianness.
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index c0b1fc293b496..ff395bf14dbc3 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
[ ... ]
> @@ -3638,6 +3639,39 @@ int hci_powered_update_sync(struct hci_dev *hdev)
> return 0;
> }
>
> +/**
> + * hci_dev_get_bd_addr_from_nvmem - Get the Bluetooth Device Address
> + * (BD_ADDR) for a HCI device from
> + * an NVMEM cell.
> + * @hdev: The HCI device
> + *
> + * Search for 'local-bd-address' NVMEM cell in the device firmware node.
> + *
> + * All-zero BD addresses are rejected (unprovisioned).
> + *
> + * Return: 0 on success, or a negative error code on failure.
> + */
> +static int hci_dev_get_bd_addr_from_nvmem(struct hci_dev *hdev)
> +{
> + struct device_node *np = dev_of_node(hdev->dev.parent);
> + u8 ba[sizeof(bdaddr_t)];
> + int err;
> +
> + if (!np)
> + return -ENODEV;
> +
> + err = of_get_nvmem_eui48(np, "local-bd-address", ba);
> + if (err)
> + return err;
[Severity: Medium]
Will this return value be handled correctly if the NVMEM provider has not
probed yet?
When of_get_nvmem_eui48() returns -EPROBE_DEFER, the error is correctly
passed up from this function. However, looking at the caller below, it seems
this might not trigger probe deferral as expected.
> +
> + if (hci_test_quirk(hdev, HCI_QUIRK_BDADDR_NVMEM_BE))
> + baswap(&hdev->public_addr, (bdaddr_t *)ba);
> + else
> + bacpy(&hdev->public_addr, (bdaddr_t *)ba);
> +
> + return 0;
> +}
[ ... ]
> @@ -5117,12 +5151,17 @@ static int hci_dev_setup_sync(struct hci_dev *hdev)
[ ... ]
> if (!ret) {
> if (hci_test_quirk(hdev, HCI_QUIRK_USE_BDADDR_PROPERTY) &&
> !bacmp(&hdev->public_addr, BDADDR_ANY))
> hci_dev_get_bd_addr_from_property(hdev);
>
> + if (hci_test_quirk(hdev, HCI_QUIRK_USE_BDADDR_NVMEM) &&
> + !bacmp(&hdev->public_addr, BDADDR_ANY))
> + hci_dev_get_bd_addr_from_nvmem(hdev);
[Severity: Medium]
Does this silently swallow initialization failures?
The return value from hci_dev_get_bd_addr_from_nvmem() is completely ignored
here. If the NVMEM provider is not yet available, the -EPROBE_DEFER error
is lost and the Bluetooth controller might be left in an unconfigured state.
Additionally, since hci_dev_setup_sync() often executes asynchronously outside
of the standard driver probe sequence, would returning the error here even
properly trigger the kernel probe deferral mechanism?
Should the NVMEM cell be fetched synchronously during the initial device probe
sequence instead of waiting for the setup synchronization phase?
> +
> if (invalid_bdaddr && bacmp(&hdev->public_addr, BDADDR_ANY) &&
> hdev->set_bdaddr) {
> ret = hdev->set_bdaddr(hdev, &hdev->public_addr);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-block-as-nvmem-v9-0-f72935817dbf@oss.qualcomm.com?part=8
next prev parent reply other threads:[~2026-07-31 16:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 16:00 [PATCH v9 00/10] Support for block device NVMEM providers Loic Poulain
2026-07-30 16:00 ` [PATCH v9 01/10] dt-bindings: mmc: Document fixed-layout NVMEM provider support Loic Poulain
2026-07-31 8:39 ` Bartosz Golaszewski
2026-07-31 16:01 ` sashiko-bot
2026-07-30 16:00 ` [PATCH v9 02/10] dt-bindings: net: wireless: qcom,ath10k: Document NVMEM cells Loic Poulain
2026-07-30 16:00 ` [PATCH v9 03/10] dt-bindings: bluetooth: qcom: Add NVMEM BD address cell Loic Poulain
2026-07-30 16:00 ` [PATCH v9 04/10] nvmem: layouts: Support fixed-layout as the nvmem device node itself Loic Poulain
2026-07-31 16:01 ` sashiko-bot
2026-07-30 16:00 ` [PATCH v9 05/10] block: partitions: of: Attach partition fwnode to the block device Loic Poulain
2026-07-31 8:40 ` Bartosz Golaszewski
2026-07-31 16:01 ` sashiko-bot
2026-07-30 16:00 ` [PATCH v9 06/10] block: implement NVMEM provider Loic Poulain
2026-07-31 16:01 ` sashiko-bot
2026-07-30 16:00 ` [PATCH v9 07/10] net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup Loic Poulain
2026-07-30 16:00 ` [PATCH v9 08/10] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval Loic Poulain
2026-07-31 16:01 ` sashiko-bot [this message]
2026-07-30 16:00 ` [PATCH v9 09/10] Bluetooth: qca: Set NVMEM BD address quirks when address is invalid Loic Poulain
2026-07-30 16:00 ` [PATCH v9 10/10] arm64: dts: qcom: arduino-imola: Describe NVMEM layout for WiFi/BT addresses Loic Poulain
2026-07-31 16:01 ` 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=20260731160125.AC1351F00ACF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox