All of lore.kernel.org
 help / color / mirror / Atom feed
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 v10 04/10] nvmem: layouts: Support fixed-layout as the nvmem device node itself
Date: Fri, 07 Aug 2026 14:39:31 +0000	[thread overview]
Message-ID: <20260807143931.ECF591F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260806-block-as-nvmem-v10-4-be598b2a5606@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] A device tree updated to explicitly mark a legacy NVMEM provider with `compatible = "fixed-layout"` will cause duplicate cell registration and fail the driver probe.
--

--- Patch [4]: [PATCH v10 04/10] nvmem: layouts: Support fixed-layout as the nvmem device node itself ---
commit d0f87955eb48c0cfb8be42e6d6cfadf192c1f792
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>

nvmem: layouts: Support fixed-layout as the nvmem device node itself

The commit modifies of_nvmem_layout_get_container() to fall back to returning
the nvmem device node itself if it's compatible with "fixed-layout". This
allows cell parsing for providers whose DT node is the fixed-layout container
directly.

> diff --git a/drivers/nvmem/layouts.c b/drivers/nvmem/layouts.c
> index b90584e1b99ea..efa631ce7283b 100644
> --- a/drivers/nvmem/layouts.c
> +++ b/drivers/nvmem/layouts.c
> @@ -167,7 +167,18 @@ static int nvmem_layout_bus_populate(struct nvmem_device *nvmem,
>  
>  struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem)
>  {
> -	return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
> +	struct device_node *np;
> +
> +	/* Search for nvmem-layout child */
> +	np = of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
> +	if (np)
> +		return np;
> +
> +	/* The nvmem of_node is itself a fixed-layout node */
> +	if (of_device_is_compatible(nvmem->dev.of_node, "fixed-layout"))
> +		return of_node_get(nvmem->dev.of_node);

[Severity: High]
Does this new logic allow a legacy provider's device node to be returned as a
fixed-layout container and parsed a second time?

If a device tree author updates a legacy NVMEM provider node (where the driver
sets config->add_legacy_fixed_of_cells = true) to explicitly include the
"fixed-layout" compatible property, nvmem_register() will parse it twice:

drivers/nvmem/core.c:nvmem_register() {
    ...
	if (config->add_legacy_fixed_of_cells) {
		rval = nvmem_add_cells_from_legacy_of(nvmem);
		if (rval)
			goto err_remove_cells;
	}

	rval = nvmem_add_cells_from_fixed_layout(nvmem);
	if (rval)
		goto err_remove_cells;
    ...
}

Because nvmem_add_one_cell() does not check for duplicates, identical cells
will be appended, causing nvmem_populate_sysfs_cells() to fail with -EEXIST
and cleanly abort the driver probe.

> +
> +	return NULL;
>  }
>  EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806-block-as-nvmem-v10-0-be598b2a5606@oss.qualcomm.com?part=4

  reply	other threads:[~2026-08-07 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 14:38 [PATCH v10 00/10] Support for block device NVMEM providers Loic Poulain
2026-08-06 14:38 ` [PATCH v10 01/10] dt-bindings: mmc: Document fixed-layout NVMEM provider support Loic Poulain
2026-08-07  1:23   ` Support for block device NVMEM providers bluez.test.bot
2026-08-06 14:38 ` [PATCH v10 02/10] dt-bindings: net: wireless: qcom,ath10k: Document NVMEM cells Loic Poulain
2026-08-06 14:38 ` [PATCH v10 03/10] dt-bindings: bluetooth: qcom: Add NVMEM BD address cell Loic Poulain
2026-08-07 14:39   ` sashiko-bot
2026-08-06 14:38 ` [PATCH v10 04/10] nvmem: layouts: Support fixed-layout as the nvmem device node itself Loic Poulain
2026-08-07 14:39   ` sashiko-bot [this message]
2026-08-06 14:38 ` [PATCH v10 05/10] block: partitions: of: Attach partition fwnode to the block device Loic Poulain
2026-08-07 14:39   ` sashiko-bot
2026-08-06 14:38 ` [PATCH v10 06/10] block: implement NVMEM provider Loic Poulain
2026-08-07 14:39   ` sashiko-bot
2026-08-06 14:38 ` [PATCH v10 07/10] net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup Loic Poulain
2026-08-06 14:38 ` [PATCH v10 08/10] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval Loic Poulain
2026-08-07 14:39   ` sashiko-bot
2026-08-06 14:38 ` [PATCH v10 09/10] Bluetooth: qca: Set NVMEM BD address quirks when address is invalid Loic Poulain
2026-08-06 14:38 ` [PATCH v10 10/10] arm64: dts: qcom: arduino-imola: Add NVMEM layout for WiFi/BT Loic Poulain

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=20260807143931.ECF591F00A3F@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 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.