未验证 提交 dc8d006d 编写于 作者: W Wang ShaoBo 提交者: Mark Brown

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: 87fe29b6 ("regulator: push allocations in create_regulator() outside of lock")
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Link: https://lore.kernel.org/r/20221123034616.3609537-1-bobo.shaobowang@huawei.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 149f5266
...@@ -1813,7 +1813,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, ...@@ -1813,7 +1813,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
if (regulator == NULL) { if (regulator == NULL) {
kfree(supply_name); kfree_const(supply_name);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册