[alsa-devel] [PATCH] snd-core: enlarge snd_card.components for up to 4 codecs

Takashi Iwai tiwai at suse.de
Tue Oct 7 11:48:10 CEST 2008


At Tue, 7 Oct 2008 17:11:18 +0800,
Wu Fengguang wrote:
> 
> On Tue, Oct 07, 2008 at 11:00:26AM +0200, Takashi Iwai wrote:
> > At Tue, 7 Oct 2008 16:34:29 +0800,
> > > FYI, this is the debug patch and kernel message(lookout the first line) on HP 2230s:
> > > 
> > > diff --git a/sound/core/init.c b/sound/core/init.c
> > > index 8af467d..704d7e8 100644
> > > --- a/sound/core/init.c
> > > +++ b/sound/core/init.c
> > > @@ -706,6 +706,8 @@ int snd_component_add(struct snd_card *card, const char *component)
> > >  			return 1;
> > >  	}
> > >  	if (strlen(card->components) + 1 + len + 1 > sizeof(card->components)) {
> > > +		snd_printk(KERN_ERR "components = %s + %s\n",
> > > +				card->components, component);
> > >  		snd_BUG();
> > >  		return -ENOMEM;
> > >  	}
> > > 
> > > 
> > > [   12.590150] ALSA sound/core/init.c:710: components = HDA:11d4194a,103c3037,00100400 HDA:11c11040,103c1378,00100200 + HDA:80862802,80860101,00100000
> > > [   12.590163] ------------[ cut here ]------------
> > > [   12.590166] WARNING: at sound/core/init.c:711 snd_component_add+0xfa/0x110 [snd]()
> > > [   12.590168] BUG?
> > (snip)
> > 
> > Argh, that's bad. 
> > Then I agree with increasing the components as a simple workaround.
> > 
> > How about the patch below?  The control protocol number is increased
> > for this change as well.
> 
> The modified patch looks fine, I'll test it out in the following days.
> 
> So far grep gives the following referees:
> 
> ./alsa-driver/acore/ioctl32/ioctl32_new.c:      MAP_COMPAT(SNDRV_CTL_IOCTL_CARD_INFO),
> ./alsa-driver/acore/ioctl32/ioctl32_old.c:      MAP_COMPAT(SNDRV_CTL_IOCTL_CARD_INFO),
> ./alsa-kernel/sound/core/control_compat.c:      case SNDRV_CTL_IOCTL_CARD_INFO:
> ./alsa-kernel/sound/core/control.c:     case SNDRV_CTL_IOCTL_CARD_INFO:
> ./alsa-kernel/include/sound/asound.h:   SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
> ./alsa-lib/src/control/control_shm.c:   ctrl->cmd = SNDRV_CTL_IOCTL_CARD_INFO;
> ./alsa-lib/src/control/control_hw.c:    if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CARD_INFO, info) < 0) {
> ./alsa-lib/src/control/control_hw.c:            SYSERR("SNDRV_CTL_IOCTL_CARD_INFO failed");
> ./alsa-lib/aserver/aserver.c:   case SNDRV_CTL_IOCTL_CARD_INFO:
> ./alsa-lib/include/sound/asound.h:      SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info),

Thanks.  These are all just referring to the struct, so it must be OK.
We need a similar fix for alsa-lib.  I'll work on it now.


Takashi


More information about the Alsa-devel mailing list