[PATCH v3 20/20] ASoC: uniphier: use devm_kmemdup_array()

Raag Jadav
2025-02-03T08:10:53Z

Convert to use devm_kmemdup_array() which is more robust.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
sound/soc/uniphier/aio-cpu.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c
index 470f129166a4..44f4053e5584 100644
--- a/sound/soc/uniphier/aio-cpu.c
+++ b/sound/soc/uniphier/aio-cpu.c
@@ -762,14 +762,10 @@ int uniphier_aio_probe(struct platform_device *pdev)
return -ENOMEM;

chip->num_plls = chip->chip_spec->num_plls;
- chip->plls = devm_kcalloc(dev,
- chip->num_plls,
- sizeof(struct uniphier_aio_pll),
- GFP_KERNEL);
+ chip->plls = devm_kmemdup_array(dev, chip->chip_spec->plls, chip->num_plls,
+ sizeof(struct uniphier_aio_pll), GFP_KERNEL);
if (!chip->plls)
return -ENOMEM;
- memcpy(chip->plls, chip->chip_spec->plls,
- sizeof(struct uniphier_aio_pll) * chip->num_plls);

for (i = 0; i < chip->num_aios; i++) {
struct uniphier_aio *aio = &chip->aios[i];
--
2.34.1