[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220825123525.1845695-1-yangyingliang@huawei.com>
Date: Thu, 25 Aug 2022 20:35:25 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <alsa-devel@...a-project.org>
CC: <lars@...afoo.de>, <nuno.sa@...log.com>, <lgirdwood@...il.com>,
<broonie@...nel.org>
Subject: [PATCH -next] ASoC: sigmadsp: switch to use kmemdup_nul() helper
Use kmemdup_nul() helper instead of open-coding to
simplify the code.
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
sound/soc/codecs/sigmadsp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index b992216aee55..3047a6fbb380 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -227,13 +227,11 @@ static int sigma_fw_load_control(struct sigmadsp *sigmadsp,
if (!ctrl)
return -ENOMEM;
- name = kzalloc(name_len + 1, GFP_KERNEL);
+ name = kmemdup_nul(ctrl_chunk->name, name_len, GFP_KERNEL);
if (!name) {
ret = -ENOMEM;
goto err_free_ctrl;
}
- memcpy(name, ctrl_chunk->name, name_len);
- name[name_len] = '\0';
ctrl->name = name;
/*
--
2.25.1
Powered by blists - more mailing lists