Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34860
b: refs/heads/master
c: f03d68f
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov authored and Jaroslav Kysela committed Sep 23, 2006
1 parent a7fddb1 commit 6a7d128
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 548a648b98318e4b843b636dd2c7f42377e19a00
refs/heads/master: f03d68fe343d70bb06ecdb3d70dcf0e678ed99f9
32 changes: 21 additions & 11 deletions trunk/sound/ppc/beep.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,18 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip)
{
struct pmac_beep *beep;
struct input_dev *input_dev;
struct snd_kcontrol *beep_ctl;
void *dmabuf;
int err = -ENOMEM;

beep = kzalloc(sizeof(*beep), GFP_KERNEL);
if (! beep)
return -ENOMEM;
dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
&beep->addr, GFP_KERNEL);
input_dev = input_allocate_device();
if (!beep || !dmabuf || !input_dev)
goto fail;
if (! dmabuf || ! input_dev)
goto fail1;

/* FIXME: set more better values */
input_dev->name = "PowerMac Beep";
Expand All @@ -244,17 +247,24 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip)
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;

chip->beep = beep;
input_register_device(beep->dev);

return 0;

fail: input_free_device(input_dev);
kfree(dmabuf);
err = input_register_device(beep->dev);
if (err)
goto fail2;

return 0;

fail2: snd_ctl_remove(chip->card, beep_ctl);
fail1: input_free_device(input_dev);
if (dmabuf)
dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4,
dmabuf, beep->addr);
kfree(beep);
return err;
}
Expand Down

0 comments on commit 6a7d128

Please sign in to comment.