Skip to content

Commit 4c71671

Browse files
tititiou36broonie
authored andcommitted
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 <[email protected]> Link: https://msgid.link/r/3f990a7b80d72c31371735b24ed08acbb8392c80.1705748586.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent a6ffa02 commit 4c71671

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/fixed-helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void regulator_fixed_release(struct device *dev)
1515
{
1616
struct fixed_regulator_data *data = container_of(dev,
1717
struct fixed_regulator_data, pdev.dev);
18-
kfree(data->cfg.supply_name);
18+
kfree_const(data->cfg.supply_name);
1919
kfree(data);
2020
}
2121

@@ -36,7 +36,7 @@ struct platform_device *regulator_register_always_on(int id, const char *name,
3636
if (!data)
3737
return NULL;
3838

39-
data->cfg.supply_name = kstrdup(name, GFP_KERNEL);
39+
data->cfg.supply_name = kstrdup_const(name, GFP_KERNEL);
4040
if (!data->cfg.supply_name) {
4141
kfree(data);
4242
return NULL;

0 commit comments

Comments
 (0)