From: Srinivas Kandagatla <srini@kernel.org>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>, rafal@milecki.pl
Cc: srini@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmem: layouts: u-boot-env: Put cell nodes on registration failure
Date: Tue, 17 Nov 2026 15:48:45 +0000 [thread overview]
Message-ID: <1cdf714e-50fb-4ad9-9d1e-a5e878f381da@kernel.org> (raw)
In-Reply-To: <20261112023114.118202-1-zhujun2@cmss.chinamobile.com>
On 11/12/26 2:31 AM, Zhu Jun wrote:
> u_boot_env_parse_cells() takes a reference to each matching child node
> before registering its cell. nvmem_add_one_cell() transfers that reference
> to the cell on success, but does not release it if cell allocation or
> initialization fails.
>
> Drop the node reference when registration fails, preserving the existing
> behavior of continuing with the remaining environment variables.
>
> OpenAI Codex assisted with analysis and patch preparation.
>
> Fixes: 7c8979b42b1a ("nvmem: u-boot-env: use nvmem_add_one_cell() nvmem subsystem helper")
Missing CC Stable
--srini
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
> drivers/nvmem/layouts/u-boot-env.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/layouts/u-boot-env.c b/drivers/nvmem/layouts/u-boot-env.c
> index 33ec2350386f..f4839571b794 100644
> --- a/drivers/nvmem/layouts/u-boot-env.c
> +++ b/drivers/nvmem/layouts/u-boot-env.c
> @@ -78,7 +78,8 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem
> info.read_post_process = u_boot_env_read_post_process_ethaddr;
> }
>
> - nvmem_add_one_cell(nvmem, &info);
> + if (nvmem_add_one_cell(nvmem, &info))
> + of_node_put(info.np);
> }
>
> return 0;
prev parent reply other threads:[~2026-11-17 15:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 2:31 Zhu Jun
2026-11-17 15:48 ` Srinivas Kandagatla [this message]
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=1cdf714e-50fb-4ad9-9d1e-a5e878f381da@kernel.org \
--to=srini@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=zhujun2@cmss.chinamobile.com \
/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
all inboxes | Powered by JetHome®