projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
252b911
)
regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpy
author
Li Zetao
<lizetao1@huawei.com>
Thu, 10 Aug 2023 11:48:58 +0000
(19:48 +0800)
committer
Mark Brown
<broonie@kernel.org>
Thu, 10 Aug 2023 14:44:43 +0000
(15:44 +0100)
Use the helper function devm_kmemdup() rather than duplicating its
implementation, which helps to enhance code readability.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
Link:
https://lore.kernel.org/r/20230810114858.2103928-1-lizetao1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/qcom_rpm-regulator.c
patch
|
blob
|
history
diff --git
a/drivers/regulator/qcom_rpm-regulator.c
b/drivers/regulator/qcom_rpm-regulator.c
index
f95bc92
..
9366488
100644
(file)
--- a/
drivers/regulator/qcom_rpm-regulator.c
+++ b/
drivers/regulator/qcom_rpm-regulator.c
@@
-956,11
+956,10
@@
static int rpm_reg_probe(struct platform_device *pdev)
}
for (reg = match->data; reg->name; reg++) {
- vreg = devm_km
alloc(&pdev->dev
, sizeof(*vreg), GFP_KERNEL);
+ vreg = devm_km
emdup(&pdev->dev, reg->template
, sizeof(*vreg), GFP_KERNEL);
if (!vreg)
return -ENOMEM;
- memcpy(vreg, reg->template, sizeof(*vreg));
mutex_init(&vreg->lock);
vreg->dev = &pdev->dev;