Skip to content

Commit

Permalink
ASoC: meson: axg-tdm-interface: use devm_kmemdup_array()
Browse files Browse the repository at this point in the history
Convert to use devm_kmemdup_array() which is more robust.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20250228062812.150004-6-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 d9d71a6 commit b26205e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sound/soc/meson/axg-tdm-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct snd_soc_dai_driver *dai_drv;
struct axg_tdm_iface *iface;
int i;

iface = devm_kzalloc(dev, sizeof(*iface), GFP_KERNEL);
if (!iface)
Expand All @@ -541,15 +540,11 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
* We'll change the number of channel provided by DAI stream, so dpcm
* channel merge can be done properly
*/
dai_drv = devm_kcalloc(dev, ARRAY_SIZE(axg_tdm_iface_dai_drv),
sizeof(*dai_drv), GFP_KERNEL);
dai_drv = devm_kmemdup_array(dev, axg_tdm_iface_dai_drv, ARRAY_SIZE(axg_tdm_iface_dai_drv),
sizeof(axg_tdm_iface_dai_drv[0]), GFP_KERNEL);
if (!dai_drv)
return -ENOMEM;

for (i = 0; i < ARRAY_SIZE(axg_tdm_iface_dai_drv); i++)
memcpy(&dai_drv[i], &axg_tdm_iface_dai_drv[i],
sizeof(*dai_drv));

/* Bit clock provided on the pad */
iface->sclk = devm_clk_get(dev, "sclk");
if (IS_ERR(iface->sclk))
Expand Down

0 comments on commit b26205e

Please sign in to comment.