ASoC: uniphier: use devm_kmemdup_array()
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>
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user