summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2023-08-10 19:47:37 +0800
committerMark Brown <broonie@kernel.org>2023-08-14 19:44:38 +0100
commitb0a4c7f5921d9c2998bdd767a93d995786d72adc (patch)
tree08919aaa77790da3a492cb9fa821c94a66439243 /sound
parent85cc1ee9505e0b458254a54ca053dabf650fd266 (diff)
downloadlinux-stable-b0a4c7f5921d9c2998bdd767a93d995786d72adc.tar.gz
linux-stable-b0a4c7f5921d9c2998bdd767a93d995786d72adc.tar.bz2
linux-stable-b0a4c7f5921d9c2998bdd767a93d995786d72adc.zip
ASoC: tas5805m: 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> Link: https://lore.kernel.org/r/20230810114738.2103792-2-lizetao1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tas5805m.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/codecs/tas5805m.c b/sound/soc/codecs/tas5805m.c
index aca3756ffab6..3b53eba38a0b 100644
--- a/sound/soc/codecs/tas5805m.c
+++ b/sound/soc/codecs/tas5805m.c
@@ -520,12 +520,11 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c)
}
tas5805m->dsp_cfg_len = fw->size;
- tas5805m->dsp_cfg_data = devm_kmalloc(dev, fw->size, GFP_KERNEL);
+ tas5805m->dsp_cfg_data = devm_kmemdup(dev, fw->data, fw->size, GFP_KERNEL);
if (!tas5805m->dsp_cfg_data) {
release_firmware(fw);
return -ENOMEM;
}
- memcpy(tas5805m->dsp_cfg_data, fw->data, fw->size);
release_firmware(fw);