On Mon, Aug 18, 2025 at 07:44:39PM +0200, Marco Felsch wrote: > Partly (re-)sync the nvmem core with Linux. The main changes are: > - The nvmem_cell struct was split into nvmem_cell and nvmem_cell_entry > - The cells are now parsed and registered during nvmem_register(), no > longer during of_nvmem_cell_get() > - The registered cells are now tracked per nvmem device, no longer in > a global nvmem_cells list > > The sync is in preparation of adding nvmem-layout driver support and > features like accessing nvmem-cells via cdevs. > > Signed-off-by: Marco Felsch <m.fel...@pengutronix.de> > --- > drivers/nvmem/core.c | 428 > ++++++++++++++++++++++++++--------------- > include/linux/nvmem-consumer.h | 17 +- > include/linux/nvmem-provider.h | 58 +++++- > 3 files changed, 326 insertions(+), 177 deletions(-) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > +static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct > device_node *np) > +{ > + struct device *dev = &nvmem->dev; > + struct device_node *child; > + const __be32 *addr; > + int len, ret; > + > + if (!IS_ENABLED(CONFIG_OFTREE)) > + return 0; > +
This needs an additional check: if (!np) return 0; > + for_each_child_of_node(np, child) { Linux gracefully handles NULL in for_each_child_of_node() whereas barebox crashes here. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |