[alsa-devel] [PATCH 6/9] ASoC: max98095: Add missing negative channel checks
Takashi Iwai
tiwai at suse.de
Wed Oct 30 18:36:21 CET 2013
At Wed, 30 Oct 2013 09:46:53 -0700,
Mark Brown wrote:
>
> On Wed, Oct 30, 2013 at 08:35:04AM +0100, Takashi Iwai wrote:
>
> > + if (channel < 0)
> > + return channel;
> > BUG_ON(channel > 1);
>
> This doesn't seem to fit in well with the adjacent code - the handling
> of out of bounds data isn't consistent though it looks like they're both
> doing essentially the same thing here.
Actually BUG_ON(channel > 1) is a pretty stupid line and should be
removed. You'll see that this never happens if you read the code.
Overall, this driver has way too many BUG_ON() without
considerations. Such BUT_ON()'s are worse than nothing, IMO.
Takashi
More information about the Alsa-devel
mailing list