media: nxp: Use devm_kmemdup to replace devm_kmalloc + memcpy

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>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Li Zetao 2023-08-10 19:52:20 +08:00 committed by Hans Verkuil
parent 57a3afc5d5
commit d27bb0246e

View File

@ -406,12 +406,10 @@ static int mxc_isi_clk_get(struct mxc_isi_dev *isi)
* sizeof(*isi->clks);
int ret;
isi->clks = devm_kmalloc(isi->dev, size, GFP_KERNEL);
isi->clks = devm_kmemdup(isi->dev, isi->pdata->clks, size, GFP_KERNEL);
if (!isi->clks)
return -ENOMEM;
memcpy(isi->clks, isi->pdata->clks, size);
ret = devm_clk_bulk_get(isi->dev, isi->pdata->num_clks,
isi->clks);
if (ret < 0) {