public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Michael Walle <michael@walle.cc>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/4] mtd: core: provide unique name for nvmem device, take two
Date: Wed, 8 Mar 2023 14:40:48 +0100	[thread overview]
Message-ID: <20230308144048.473e2ec7@xps-13> (raw)
In-Reply-To: <20230308082021.870459-1-michael@walle.cc>

Hi Michael,

michael@walle.cc wrote on Wed,  8 Mar 2023 09:20:18 +0100:

> 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@vger.kernel.org
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> v2:
>  - actually use NVMEM_DEVID_AUTO as described in the commit message
> 

Thanks for the v2, as I want to share a clean immutable branch with
Greg, I made an exception in force pushing this patch in place of its
v1 counterpart.

>  drivers/mtd/mtdcore.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 0feacb9fbdac..8fc66cda4a09 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -888,8 +888,8 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
>  
>  	/* 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;
> @@ -905,7 +905,6 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
>  		nvmem = NULL;
>  
>  	of_node_put(np);
> -	kfree(config.name);
>  
>  	return nvmem;
>  }


Thanks,
Miquèl

      parent reply	other threads:[~2023-03-08 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08  8:20 [PATCH v2 1/4] mtd: core: provide unique name for nvmem device, take two Michael Walle
2023-03-08  8:20 ` [PATCH v2 2/4] mtd: core: fix nvmem error reporting Michael Walle
2023-03-08  8:20 ` [PATCH v2 3/4] mtd: core: fix error path for nvmem provider Michael Walle
2023-03-08  8:20 ` [PATCH v2 4/4] mtd: core: prepare mtd_otp_nvmem_add() to handle -EPROBE_DEFER Michael Walle
2023-03-08 13:40 ` Miquel Raynal [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=20230308144048.473e2ec7@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.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