mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-mtd@lists.infradead.org,
	Michal Simek <michal.simek@amd.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Chenyuan Yang <chenyuan0y@gmail.com>,
	Michael Walle <michael@walle.cc>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] mtd: rawnand: pl353: Replace devm_kasprintf() call by devm_kstrdup() in pl35x_nand_chip_init()
Date: Wed, 16 Apr 2025 17:00:08 +0200	[thread overview]
Message-ID: <81979474-04ac-4712-a28b-3d15b697c97e@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Apr 2025 16:52:04 +0200

Use a devm_kstrdup() call instead of a devm_kasprintf() call
in this function implementation because only a single string
should be copied.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mtd/nand/raw/pl35x-nand-controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c
index 09440ed4652e..86f684bf8624 100644
--- a/drivers/mtd/nand/raw/pl35x-nand-controller.c
+++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c
@@ -1071,8 +1071,8 @@ static int pl35x_nand_chip_init(struct pl35x_nandc *nfc,
 	mtd->dev.parent = nfc->dev;
 	nand_set_flash_node(chip, np);
 	if (!mtd->name) {
-		mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
-					   "%s", PL35X_NANDC_DRIVER_NAME);
+		mtd->name = devm_kstrdup(nfc->dev, PL35X_NANDC_DRIVER_NAME,
+					 GFP_KERNEL);
 		if (!mtd->name) {
 			dev_err(nfc->dev, "Failed to allocate mtd->name\n");
 			return -ENOMEM;
-- 
2.49.0


                 reply	other threads:[~2025-04-16 15:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=81979474-04ac-4712-a28b-3d15b697c97e@web.de \
    --to=markus.elfring@web.de \
    --cc=chenyuan0y@gmail.com \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@amd.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --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

all inboxes | Powered by JetHome®