diff options
author | Wang ShaoBo <[email protected]> | 2022-11-23 11:46:16 +0800 |
---|---|---|
committer | Mark Brown <[email protected]> | 2022-11-23 13:09:08 +0000 |
commit | dc8d006d15b623c1d80b90b45d6dcb6e890dad09 (patch) | |
tree | ce4ae62a414fc5d8b04989f7b6b3658a96d9e7f5 | |
parent | 149f52664bb3ffe95e6212f20971d40efec2aa68 (diff) |
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: 87fe29b61f95 ("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]>
-rw-r--r-- | drivers/regulator/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 3f6c6185c187..989b22249ca2 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1813,7 +1813,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); if (regulator == NULL) { - kfree(supply_name); + kfree_const(supply_name); return NULL; } |