aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2024-01-20 12:03:26 +0100
committerMark Brown <broonie@kernel.org>2024-01-22 17:56:32 +0000
commit4c716711a5c5e89202facc9ca816bc89d4b8c745 (patch)
treec06408fb3e0b393071090eaa02bf5e2d3fb78a94 /drivers/regulator
parenta6ffa02ba7a28fe1bba06eacb224554d89a1cd4d (diff)
downloadlinux-4c716711a5c5e89202facc9ca816bc89d4b8c745.tar.gz
regulator: fixed-helper: Save a few bytes of memory when registering a 'nfc_llc' engine
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/fixed-helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c
index 0eb2442456f0c..2d5a42b2b3d80 100644
--- 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;