This is a note to let you know that I've just added the patch titled mtd: core: provide unique name for nvmem device, take two to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mtd-core-provide-unique-name-for-nvmem-device-take-two.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1cd9ceaa5282ff10ea20a7fbadde5a476a1cc99e Mon Sep 17 00:00:00 2001 From: Michael Walle <michael@xxxxxxxx> Date: Wed, 8 Mar 2023 09:20:18 +0100 Subject: mtd: core: provide unique name for nvmem device, take two From: Michael Walle <michael@xxxxxxxx> commit 1cd9ceaa5282ff10ea20a7fbadde5a476a1cc99e upstream. Commit c048b60d39e1 ("mtd: core: provide unique name for nvmem device") tries to give the nvmem device a unique name, but fails badly if the mtd device doesn't have a "struct device" associated with it, i.e. if CONFIG_MTD_PARTITIONED_MASTER is not set. This will result in the name "(null)-user-otp", which is not unique. It seems the best we can do is to use the compatible name together with a unique identifier added by the nvmem subsystem by using NVMEM_DEVID_AUTO. Fixes: c048b60d39e1 ("mtd: core: provide unique name for nvmem device") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Michael Walle <michael@xxxxxxxx> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> Link: https://lore.kernel.org/linux-mtd/20230308082021.870459-1-michael@xxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/mtd/mtdcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -828,8 +828,8 @@ static struct nvmem_device *mtd_otp_nvme /* OTP nvmem will be registered on the physical device */ config.dev = mtd->dev.parent; - config.name = kasprintf(GFP_KERNEL, "%s-%s", dev_name(&mtd->dev), compatible); - config.id = NVMEM_DEVID_NONE; + config.name = compatible; + config.id = NVMEM_DEVID_AUTO; config.owner = THIS_MODULE; config.type = NVMEM_TYPE_OTP; config.root_only = true; @@ -845,7 +845,6 @@ static struct nvmem_device *mtd_otp_nvme nvmem = NULL; of_node_put(np); - kfree(config.name); return nvmem; } Patches currently in stable-queue which might be from michael@xxxxxxxx are queue-5.15/mtd-core-fix-nvmem-error-reporting.patch queue-5.15/mtd-core-fix-error-path-for-nvmem-provider.patch queue-5.15/mtd-core-provide-unique-name-for-nvmem-device-take-two.patch