[Sound-open-firmware] [PATCH] Volume: Code cleanup for minimum gain value limiting

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Dec 20 11:09:05 CET 2017


On Wed, 2017-12-20 at 12:01 +0200, Seppo Ingalsuo wrote:
> This patch changes the condition for limiting the smallest gain to
> eliminate a never executed code part when VOL_MIN is defined as zero.
> The
> variable v is unsigned integer so less than zero is not possible.
> The functionality is not modified by this patch.
> 
> Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo at linux.intel.com>
> ---
>  src/audio/volume.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/audio/volume.c b/src/audio/volume.c
> index 6130563..3b3e2aa 100644
> --- a/src/audio/volume.c
> +++ b/src/audio/volume.c
> @@ -427,7 +427,7 @@ static inline void volume_set_chan(struct
> comp_dev *dev, int chan, uint32_t vol)
>  	 * multiplication overflow with the 32 bit value. Non-zero
> MIN option
>  	 * can be useful to prevent totally muted small volume gain.
>  	 */
> -	if (v < VOL_MIN)
> +	if (v <= VOL_MIN)
>  		v = VOL_MIN;
>  
>  	if (v > VOL_MAX)

Applied.


More information about the Sound-open-firmware mailing list