[PATCH v3 10/17] ASoC: Intel: avs: Add basefw runtime-parameter requests
Cezary Rojewski
cezary.rojewski at intel.com
Mon Mar 7 18:02:09 CET 2022
On 2022-03-07 5:41 PM, Ranjani Sridharan wrote:
>>>> + kfree(payload);
>>> I think it would be easier to understand this kfree if payload was
>>> also
>>> allocated in this function in stead of inside the
>>> get_large_config().
>>
>> That's a good thinking. There was an internal conversation regarding
>> this back in time when we have been implementing getters for the
>> first
>> time. There are no clear victors, there are drawbacks - as you do
>> not
>> know the size upfront, caller has to guess and then reallocate the
>> buffer accordingly to retrieved payload size from the firmware. So,
>> even
>> if you allocate buffer here, chances are, it's not the same buffer
>> when
>> the avs_ipc_get_large_config() returns to the caller.
>>
>> We have decided to reduce the code size by letting the single,
>> common
>> handler do the allocation and leave the other responsibilities to
>> the
>> caller.
>
> What could make it simpler is if you allocate MAX IPC size for payload
> in this function and then copy the right size in the
> avs_ipc_get_large_config(). payload_size tells you that information
> anyway right?
As stated, there is no clear winner here - you had to repeat such code
for every getter.
Since we are getting payload_size already, retrieving payload itself is
just fine.
Regards,
Czarek
More information about the Alsa-devel
mailing list