summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2024-02-03 08:51:04 +0100
committerPaolo Abeni <pabeni@redhat.com>2024-02-06 15:36:06 +0100
commit83cdd8db75085f3e415f420d6022f9c813ea50af (patch)
treebb91bb5363cafa206f4fbd36f82e4eb868dba776 /net/nfc
parentd6f4aac19ad44998c6b1cde0334ad76900136ca4 (diff)
downloadlinux-83cdd8db75085f3e415f420d6022f9c813ea50af.tar.gz
linux-83cdd8db75085f3e415f420d6022f9c813ea50af.tar.bz2
linux-83cdd8db75085f3e415f420d6022f9c813ea50af.zip
nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine
nfc_llc_register() calls pass a string literal as the 'name' parameter. So kstrdup_const() can be used instead of kfree() to avoid a memory allocation in such cases. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/hci/llc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/nfc/hci/llc.c b/net/nfc/hci/llc.c
index 480c17f372a5..ba91284f4086 100644
--- a/net/nfc/hci/llc.c
+++ b/net/nfc/hci/llc.c
@@ -33,7 +33,7 @@ exit:
static void nfc_llc_del_engine(struct nfc_llc_engine *llc_engine)
{
list_del(&llc_engine->entry);
- kfree(llc_engine->name);
+ kfree_const(llc_engine->name);
kfree(llc_engine);
}
@@ -53,7 +53,7 @@ int nfc_llc_register(const char *name, const struct nfc_llc_ops *ops)
if (llc_engine == NULL)
return -ENOMEM;
- llc_engine->name = kstrdup(name, GFP_KERNEL);
+ llc_engine->name = kstrdup_const(name, GFP_KERNEL);
if (llc_engine->name == NULL) {
kfree(llc_engine);
return -ENOMEM;