Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christophe JAILLET and committed by
Mark Brown
4c716711 a6ffa02b

+2 -2
+2 -2
drivers/regulator/fixed-helper.c
··· 15 15 { 16 16 struct fixed_regulator_data *data = container_of(dev, 17 17 struct fixed_regulator_data, pdev.dev); 18 - kfree(data->cfg.supply_name); 18 + kfree_const(data->cfg.supply_name); 19 19 kfree(data); 20 20 } 21 21 ··· 36 36 if (!data) 37 37 return NULL; 38 38 39 - data->cfg.supply_name = kstrdup(name, GFP_KERNEL); 39 + data->cfg.supply_name = kstrdup_const(name, GFP_KERNEL); 40 40 if (!data->cfg.supply_name) { 41 41 kfree(data); 42 42 return NULL;