At Tue, 1 Aug 2006 23:05:54 -0400, Dmitry Torokhov wrote: > > Not tested - no hardware. I'd rather change the calls of input_register_device() and snd_ctl_add() stuff. Oh, there are still other leaks in the error path. I'll fix them, too. BTW, does one need to input_free_device() after input_unregister_device()? thanks, Takashi > > -- > Dmitry > > > > ppc-beep: handle errors from input_register_device() > > Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx> > --- > > sound/ppc/beep.c | 16 +++++++++++----- > 1 files changed, 11 insertions(+), 5 deletions(-) > > Index: work/sound/ppc/beep.c > =================================================================== > --- work.orig/sound/ppc/beep.c > +++ work/sound/ppc/beep.c > @@ -215,6 +215,7 @@ int __init snd_pmac_attach_beep(struct s > { > struct pmac_beep *beep; > struct input_dev *input_dev; > + struct snd_kcontrol *beep_ctl; > void *dmabuf; > int err = -ENOMEM; > > @@ -223,7 +224,7 @@ int __init snd_pmac_attach_beep(struct s > &beep->addr, GFP_KERNEL); > input_dev = input_allocate_device(); > if (!beep || !dmabuf || !input_dev) > - goto fail; > + goto fail1; > > /* FIXME: set more better values */ > input_dev->name = "PowerMac Beep"; > @@ -244,16 +245,21 @@ int __init snd_pmac_attach_beep(struct s > beep->volume = BEEP_VOLUME; > beep->running = 0; > > - err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip)); > + beep_ctl = snd_ctl_new1(&snd_pmac_beep_mixer, chip); > + err = snd_ctl_add(chip->card, beep_ctl); > if (err < 0) > - goto fail; > + goto fail1; > > chip->beep = beep; > - input_register_device(beep->dev); > + > + err = input_register_device(beep->dev); > + if (err) > + goto fail2; > > return 0; > > - fail: input_free_device(input_dev); > + fail2: snd_ctl_remove(chip->card, beep_ctl); > + fail1: input_free_device(input_dev); > kfree(dmabuf); > kfree(beep); > return err; > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel