Skip to content

Commit

Permalink
ASoC: uniphier: use devm_kmemdup_array()
Browse files Browse the repository at this point in the history
Convert to use devm_kmemdup_array() and while at it, make the size robust
against type changes.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20250228062812.150004-7-raag.jadav@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Raag Jadav authored and Mark Brown committed Feb 28, 2025
1 parent b26205e commit c173b5e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions sound/soc/uniphier/aio-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(*chip->chip_spec->plls), 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];
Expand Down

0 comments on commit c173b5e

Please sign in to comment.