[alsa-devel] [PATCH] ASoC: Ensure we generate a driver name

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Sep 21 14:41:21 CEST 2011


On Wed, Sep 21, 2011 at 01:09:30PM +0800, Scott Jiang wrote:
> 2011/9/20 Mark Brown <broonie at opensource.wolfsonmicro.com>:

> > +       for (i = 0; i < ARRAY_SIZE(card->snd_card->driver); i++) {
> > +               switch (card->snd_card->driver[i]) {
> > +               case '_':
> > +               case '-':
> > +               case '\0':
> > +                       break;
> > +               default:
> > +                       if (!isalnum(card->snd_card->driver[i]))
> > +                               card->snd_card->driver[i] = '_';
> > +                       break;
> > +               }
> > +       }

> If '\0', we should break out of loop?

It's really not worth the code complexity, we only run this once during
probe and the array is fixed size and small.


More information about the Alsa-devel mailing list