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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 149f526 commit dc8d006

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)