Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use devm_kmemdup to replace devm_kmalloc + memcpy

Merge series from Li Zetao <lizetao1@huawei.com>:

This patch set use the helper function devm_kmemdup() to replace
devm_kmalloc + memcpy, which is the same as implementing the function
separately.

+2 -6
+1 -2
sound/soc/codecs/tas5805m.c
··· 520 520 } 521 521 522 522 tas5805m->dsp_cfg_len = fw->size; 523 - tas5805m->dsp_cfg_data = devm_kmalloc(dev, fw->size, GFP_KERNEL); 523 + tas5805m->dsp_cfg_data = devm_kmemdup(dev, fw->data, fw->size, GFP_KERNEL); 524 524 if (!tas5805m->dsp_cfg_data) { 525 525 release_firmware(fw); 526 526 return -ENOMEM; 527 527 } 528 - memcpy(tas5805m->dsp_cfg_data, fw->data, fw->size); 529 528 530 529 release_firmware(fw); 531 530
+1 -4
sound/soc/sof/ipc3.c
··· 567 567 /* create read-only cc_version debugfs to store compiler version info */ 568 568 /* use local copy of the cc_version to prevent data corruption */ 569 569 if (sdev->first_boot) { 570 - sdev->cc_version = devm_kmalloc(sdev->dev, cc->ext_hdr.hdr.size, 571 - GFP_KERNEL); 572 - 570 + sdev->cc_version = devm_kmemdup(sdev->dev, cc, cc->ext_hdr.hdr.size, GFP_KERNEL); 573 571 if (!sdev->cc_version) 574 572 return -ENOMEM; 575 573 576 - memcpy(sdev->cc_version, cc, cc->ext_hdr.hdr.size); 577 574 ret = snd_sof_debugfs_buf_item(sdev, sdev->cc_version, 578 575 cc->ext_hdr.hdr.size, 579 576 "cc_version", 0444);