Skip to content

Commit dc8d006

Browse files
Wang ShaoBobroonie
authored andcommitted
regulator: core: use kfree_const() to free space conditionally
Use kfree_const() to free supply_name conditionally in create_regulator() as supply_name may be allocated from kmalloc() or directly from .rodata section. Fixes: 87fe29b ("regulator: push allocations in create_regulator() outside of lock") Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com> Link: https://lore.kernel.org/r/20221123034616.3609537-1-bobo.shaobowang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 149f526 commit dc8d006

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/regulator/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
18131813

18141814
regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
18151815
if (regulator == NULL) {
1816-
kfree(supply_name);
1816+
kfree_const(supply_name);
18171817
return NULL;
18181818
}
18191819

0 commit comments

Comments
 (0)