From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linus Walleij <linus.walleij@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Chenyuan Yang <chenyuan0y@gmail.com>
Subject: [PATCH] misc: sram: Replace devm_kasprintf() call by devm_kstrdup() in sram_reserve_regions()
Date: Wed, 16 Apr 2025 16:30:20 +0200 [thread overview]
Message-ID: <44df2f04-655e-47cc-8785-0855377c4bf7@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Apr 2025 16:10:06 +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/misc/sram.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index e5069882457e..5a2412ca43cd 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -235,8 +235,9 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
goto err_chunks;
}
if (!label)
- block->label = devm_kasprintf(sram->dev, GFP_KERNEL,
- "%s", of_node_full_name(child));
+ block->label = devm_kstrdup(sram->dev,
+ of_node_full_name(child),
+ GFP_KERNEL);
else
block->label = devm_kstrdup(sram->dev,
label, GFP_KERNEL);
--
2.49.0
reply other threads:[~2025-04-16 14:30 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=44df2f04-655e-47cc-8785-0855377c4bf7@web.de \
--to=markus.elfring@web.de \
--cc=arnd@arndb.de \
--cc=chenyuan0y@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/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®