[alsa-devel] [PATCH] alsa-lib/tlv: fix handling of raw value ranges

Benoît Thébaudeau benoit.thebaudeau at advansee.com
Fri Mar 30 15:58:51 CEST 2012

Clemens Ladisch wrote:
> I'll see if I can cobble together some TLV checking code ...


> > Because it's useless to wait until the end of the loop to return
> > -EINVAL,
> It is not necessary to optimize for error cases.

It's not an optimization, but a simplification. Otherwise, pos would have to be
tested again after the loop to differentiate the loop-skipped case from the
at-least-one-loop-iteration cases to return either -EINVAL or the prev submax.

> > and with my patch, the after-loop code becomes the fallback case
> > for beyond-
> > final-range values, so it avoids adding a weird extra check there.
> But why does this force you to use do instead of while?

It doesn't. It's just that it's useless to keep a while here as the 1st
iteration will necessarily occur thanks to the previous if.


More information about the Alsa-devel mailing list