Message ID | 20230810114858.2103928-1-lizetao1@huawei.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [-next] regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpy | expand |
On Thu, Aug 10, 2023 at 07:48:58PM +0800, Li Zetao wrote: > 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> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com> Regards, Bjorn
On Thu, 10 Aug 2023 19:48:58 +0800, Li Zetao wrote: > Use the helper function devm_kmemdup() rather than duplicating its > implementation, which helps to enhance code readability. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next Thanks! [1/1] regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpy commit: 55975401fdf86ffe4736a557ae9d6f3d81ee5ba6 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c index f95bc9208c13..9366488f0383 100644 --- 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_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); + vreg = devm_kmemdup(&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;
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> --- drivers/regulator/qcom_rpm-regulator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)