Re: [PATCH -next 1/2] ASoC: tas5805m: Use devm_kmemdup to replace devm_kmalloc + memcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 10, 2023 at 07:47:37PM +0800, Li Zetao wrote:
> -	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);

You could probably now move the release_firmware call to be immediately
after the devm_kmemdup attempt, and avoid having to call it from two
different places.

Cheers,
Daniel

-- 
Daniel Beer
Firmware Engineer at Igor Institute
daniel.beer@xxxxxxxxxxxxxxxxx or +64-27-420-8101
Offices in Seattle, San Francisco, and Vancouver BC or (206) 494-3312



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux