projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6ffa02
)
regulator: fixed-helper: Save a few bytes of memory when registering a 'nfc_llc'...
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Sat, 20 Jan 2024 11:03:26 +0000
(12:03 +0100)
committer
Mark Brown
<broonie@kernel.org>
Mon, 22 Jan 2024 17:56:32 +0000
(17:56 +0000)
regulator_register_always_on() 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>
Link:
https://msgid.link/r/3f990a7b80d72c31371735b24ed08acbb8392c80.1705748586.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/fixed-helper.c
patch
|
blob
|
history
diff --git
a/drivers/regulator/fixed-helper.c
b/drivers/regulator/fixed-helper.c
index 0eb2442456f0c7a8c246743ea4aa023cad0c6450..2d5a42b2b3d801e11fc97befd1e077a779b285bc 100644
(file)
--- a/
drivers/regulator/fixed-helper.c
+++ b/
drivers/regulator/fixed-helper.c
@@
-15,7
+15,7
@@
static void regulator_fixed_release(struct device *dev)
{
struct fixed_regulator_data *data = container_of(dev,
struct fixed_regulator_data, pdev.dev);
- kfree(data->cfg.supply_name);
+ kfree
_const
(data->cfg.supply_name);
kfree(data);
}
@@
-36,7
+36,7
@@
struct platform_device *regulator_register_always_on(int id, const char *name,
if (!data)
return NULL;
- data->cfg.supply_name = kstrdup(name, GFP_KERNEL);
+ data->cfg.supply_name = kstrdup
_const
(name, GFP_KERNEL);
if (!data->cfg.supply_name) {
kfree(data);
return NULL;