Commit 83cdd8db authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Paolo Abeni

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent d6f4aac1
......@@ -33,7 +33,7 @@ int __init nfc_llc_init(void)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment