[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 1/3] audio/paaudio: fix ignored buffer_length
From: |
Martin Schrodt |
Subject: |
Re: [Qemu-devel] [PATCH V2 1/3] audio/paaudio: fix ignored buffer_length setting |
Date: |
Fri, 15 Mar 2019 07:28:38 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 |
On 3/14/19 10:34 PM, Philippe Mathieu-Daudé wrote:
>> +static int qpa_validate_per_direction_opts (Audiodev *dev,
>> AudiodevPaPerDirectionOptions *pdo)
>
> If this function is expected to return a boolean value, please use the
> 'bool' C type and true/false.
>
>> +{
>> + if (!pdo->has_buffer_length) {
>> + pdo->has_buffer_length = true;
>> + pdo->buffer_length = dev->timer_period * 4;
>
> buffer_length set: return true.
>
>> + }
>
> else, also return true?
>
> Why return a value then?
>
>> + return 1;
>> +}
You're right, in the current state it makes no sense. I did it because I
also want to add the possibility that validation fails. For example, a
buffer length of 0 is invalid, but the case is not handled at the
moment. Since I was not sure how exactly to do the validation (wanted
Kraxel to answer first), that case is missing atm.