diff -urN --exclude '*~' --exclude '*.o' --exclude '*.ko' --exclude tags sound/pci/emu10k1.orig/emufx.c sound/pci/emu10k1/emufx.c --- sound/pci/emu10k1.orig/emufx.c 2004-05-29 22:04:44.000000000 +0200 +++ sound/pci/emu10k1/emufx.c 2004-05-30 18:27:11.000000000 +0200 @@ -980,9 +980,29 @@ nctl.value[j] = ~gctl.value[j]; /* inverted, we want to write new value in gpr_ctl_put() */ val->value.integer.value[j] = gctl.value[j]; } - nctl.min = gctl.min; - nctl.max = gctl.max; nctl.translation = gctl.translation; + switch (nctl.translation) { + case EMU10K1_GPR_TRANSLATION_TABLE100: + nctl.min = max(gctl.min, (unsigned int) 0); + nctl.max = min(gctl.max,sizeof(db_table)/sizeof(db_table[0])-1); + break; + case EMU10K1_GPR_TRANSLATION_BASS: + nctl.min = max(gctl.min, (unsigned int) 0); + nctl.max = min(gctl.max,sizeof(bass_table)/sizeof(bass_table[0])-1); + break; + case EMU10K1_GPR_TRANSLATION_TREBLE: + nctl.min = max(gctl.min, (unsigned int) 0); + nctl.max = min(gctl.max,sizeof(treble_table)/sizeof(treble_table[0])-1); + break; + case EMU10K1_GPR_TRANSLATION_ONOFF: + nctl.min = max(gctl.min, (unsigned int) 0); + nctl.max = min(gctl.max,sizeof(onoff_table)/sizeof(onoff_table[0])-1); + break; + default: + nctl.min = gctl.min; + nctl.max = gctl.max; + break; + } if (ctl == NULL) { ctl = (snd_emu10k1_fx8010_ctl_t *)kmalloc(sizeof(*ctl), GFP_KERNEL); if (ctl == NULL)