forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/synth/emux/emux_nrpn.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * NRPN / SYSEX callbacks for Emu8k/Emu10k1
34 *
45 * Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
206 */
217
228 #include "emux_voice.h"
....@@ -77,7 +63,7 @@
7763 /* effect sensitivities for GS NRPN:
7864 * adjusted for chaos 8MB soundfonts
7965 */
80
-static int gs_sense[] =
66
+static const int gs_sense[] =
8167 {
8268 DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
8369 DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY
....@@ -86,7 +72,7 @@
8672 /* effect sensitivies for XG controls:
8773 * adjusted for chaos 8MB soundfonts
8874 */
89
-static int xg_sense[] =
75
+static const int xg_sense[] =
9076 {
9177 DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
9278 DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY
....@@ -363,6 +349,9 @@
363349 snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
364350 int param)
365351 {
352
+ if (param >= ARRAY_SIZE(chan->control))
353
+ return -EINVAL;
354
+
366355 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
367356 port, chan, param,
368357 chan->control[param],