[PATCH v8 3/8] nvmem: core: take a reference on dev.of_node in nvmem_register()

Miquel Raynal miquel.raynal at bootlin.com
Wed Oct 14 01:36:26 PDT 2026


On 14/10/2026 at 12:10:07 +0530, Manikandan Muralidharan <manikandan.m at microchip.com> wrote:

> nvmem_register() stores config->of_node (or config->dev->of_node)
> into nvmem->dev.of_node without taking its own reference. Callers
> that get the node via of_get_compatible_child() etc. and drop their
> reference right after registering leave nvmem->dev.of_node backed by
> no reference at all.
>
> Take an of_node_get() when assigning nvmem->dev.of_node and release
> it in nvmem_release(). Existing callers that hold their own get/put
> pair around the registration call need no changes, since get/put on
> a device_node is per-holder and independent of core now also holding
> one.
>
> Suggested-by: Michael Walle <mwalle at kernel.org>
> Signed-off-by: Manikandan Muralidharan <manikandan.m at microchip.com>

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>



More information about the linux-arm-kernel mailing list