diff mbox series

[-next] ASoC: sigmadsp: switch to use kmemdup_nul() helper

Message ID 20220825123525.1845695-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Commit 4a34613b2017e89fdf4f63cda65da68b5f50f284
Headers show
Series [-next] ASoC: sigmadsp: switch to use kmemdup_nul() helper | expand

Commit Message

Yang Yingliang Aug. 25, 2022, 12:35 p.m. UTC
Use kmemdup_nul() helper instead of open-coding to
simplify the code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 sound/soc/codecs/sigmadsp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Mark Brown Aug. 25, 2022, 3:28 p.m. UTC | #1
On Thu, 25 Aug 2022 20:35:25 +0800, Yang Yingliang wrote:
> Use kmemdup_nul() helper instead of open-coding to
> simplify the code.
> 
> 

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: sigmadsp: switch to use kmemdup_nul() helper
      commit: 4a34613b2017e89fdf4f63cda65da68b5f50f284

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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;
 
 	/*