--- zzzz-none-000/linux-3.10.107/sound/drivers/opl3/opl3_midi.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/drivers/opl3/opl3_midi.c 2021-02-04 17:41:59.000000000 +0000 @@ -105,6 +105,8 @@ int pitchbend = chan->midi_pitchbend; int segment; + if (pitchbend < -0x2000) + pitchbend = -0x2000; if (pitchbend > 0x1FFF) pitchbend = 0x1FFF; @@ -258,12 +260,10 @@ spin_unlock_irqrestore(&opl3->voice_lock, flags); spin_lock_irqsave(&opl3->sys_timer_lock, flags); - if (again) { - opl3->tlist.expires = jiffies + 1; /* invoke again */ - add_timer(&opl3->tlist); - } else { + if (again) + mod_timer(&opl3->tlist, jiffies + 1); /* invoke again */ + else opl3->sys_timer_status = 0; - } spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); } @@ -275,8 +275,7 @@ unsigned long flags; spin_lock_irqsave(&opl3->sys_timer_lock, flags); if (! opl3->sys_timer_status) { - opl3->tlist.expires = jiffies + 1; - add_timer(&opl3->tlist); + mod_timer(&opl3->tlist, jiffies + 1); opl3->sys_timer_status = 1; } spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); @@ -390,6 +389,11 @@ voice = snd_opl3_oss_map[chan->number]; } + if (voice < 0) { + spin_unlock_irqrestore(&opl3->voice_lock, flags); + return; + } + if (voice < MAX_OPL2_VOICES) { /* Left register block for voices 0 .. 8 */ reg_side = OPL3_LEFT;