[alsa-devel] [PATCH - alsa-lib 1/3] tlv: Check out of range dB with SND_CTL_TLVT_DB_RANGE

Peter Ujfalusi peter.ujfalusi at nokia.com
Tue Jul 20 07:34:02 CEST 2010


On Monday 19 July 2010 18:48:06 ext Takashi Iwai wrote:
> > +		if (snd_tlv_get_dB_range(tlv, rangemin, rangemax,
> > +					 &dbmin, &dbmax))
> > +			return -EINVAL;
> > +		if (db_gain <= dbmin || db_gain >= dbmax) {
> > +			*value = db_gain <= dbmin ? rangemin : rangemax;
> > +			return 0;
> > +		}
> 
> The check looks good, but IMO, just plain two if's are more intuitive:
> 
> 		if (db_gain <= dbmin) {
> 			*value = rangemin;
> 			return 0;
> 		} else if (db_gain >= dbmax) {
> 			*value = rangemax;
> 			return 0;
> 		}

I will change the check, and resubmit the patch (or the series)

> thanks,
> 
> Takashi


Thank you,
Péter


More information about the Alsa-devel mailing list