X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Fppc%2Fbeep.c;h=89f5c328acfe04952c1dcb4a2c0c66b0a16a70ea;hb=5e246b850df563224be26f1d409cf66fd6c968df;hp=566b5ab9d4e892008c95c5658746b7f4fb3aff28;hpb=4800be295c34268fd3211d49828bfaa6bf62867f;p=linux-2.6-omap-h63xx.git diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 566b5ab9d4e..89f5c328acf 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include @@ -186,7 +185,8 @@ static int snd_pmac_get_beep(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); - snd_assert(chip->beep, return -ENXIO); + if (snd_BUG_ON(!chip->beep)) + return -ENXIO; ucontrol->value.integer.value[0] = chip->beep->volume; return 0; } @@ -195,10 +195,14 @@ static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); - int oval; - snd_assert(chip->beep, return -ENXIO); + unsigned int oval, nval; + if (snd_BUG_ON(!chip->beep)) + return -ENXIO; oval = chip->beep->volume; - chip->beep->volume = ucontrol->value.integer.value[0]; + nval = ucontrol->value.integer.value[0]; + if (nval > 100) + return -EINVAL; + chip->beep->volume = nval; return oval != chip->beep->volume; }