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

Takashi Iwai tiwai at suse.de
Tue Sep 20 15:32:48 CEST 2011


At Tue, 20 Sep 2011 14:18:05 +0100,
Mark Brown wrote:
> 
> On Tue, Sep 20, 2011 at 03:11:08PM +0200, Takashi Iwai wrote:
> > Mark Brown wrote:
> 
> > > +	snprintf(card->snd_card->driver, sizeof(card->snd_card->driver),
> > > +		 "%s", card->driver_name ? card->driver_name : card->name);
> > > +	for (i = 0; i < ARRAY_SIZE(card->snd_card->driver); i++) {
> 
> > Should check card->snd_card->driver[i] != 0 here, too.
> 
> *sigh*  This sort of issue is why I'd prefer to just squash specific
> characters, especially given that we're just being random about what a
> valid character is.

Heh.  Or just use a char *, such as

	char *p;
	...
	for (p = card->snd_card->driver; *p; p++) {
		if (*p != '_' && *p != '-' && !isalnum(*p))
			*p = '_';
	}


Takashi


More information about the Alsa-devel mailing list