Skip to contentSkip to conversation

ALSA: ump: Drop redundant check of note-on with zero velocity

PATCH New Takashi Iwai 1 participant 2 messages May 25, 2023 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ALSA: ump: Drop redundant check of note-on with zero velocity

The check of a note-on event with zero velocity is done twice, and the latter one is superfluous. Let's drop it.

Fixes 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
---
 sound/core/ump_convert.c | 3 ---
 1 file changed, 3 deletions(-)
sound/core/ump_convert.c +0 -3
index cb7c2f959a27..164829d3e305 100644
@@ -340,9 +340,6 @@ static int cvt_legacy_cmd_to_ump(struct snd_ump_endpoint *ump,
 
 	switch (status) {
 	case UMP_MSG_STATUS_NOTE_ON:
-		if (!buf[2])
-			status = UMP_MSG_STATUS_NOTE_OFF;
-		fallthrough;
 	case UMP_MSG_STATUS_NOTE_OFF:
 		midi2->note.note = buf[1];
 		midi2->note.velocity = upscale_7_to_16bit(buf[2]);
Signature · 1 line
2.35.3
#1 lore raw

PATCH 2/2 ALSA: ump: Fix parsing of 0xFx command

The MIDI 1.0 parser retrieved the 0xFx command with a wrong bit shift, resulting in the bogus type. Fix the bit shift size.

Fixes 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
---
 sound/core/ump_convert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/ump_convert.c +1 -1
index 164829d3e305..48ab3e1bd62e 100644
@@ -454,7 +454,7 @@ static int do_convert_to_ump(struct snd_ump_endpoint *ump,
 	}
 
 	if (c & 0x80) {
-		bytes = cmd_bytes[(c >> 8) & 7];
+		bytes = cmd_bytes[(c >> 4) & 7];
 		cvt->buf[0] = c;
 		cvt->len = 1;
 		cvt->cmd_bytes = bytes;
Signature · 1 line
2.35.3