From ef965ad5a7697ff16e3be01954f5c57208e36c22 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 1 Aug 2018 14:38:18 +0200 Subject: ALSA: seq: Minor cleanup of MIDI event parser helpers snd_midi_event_encode_byte() can never fail, and it can return rather true/false. Change the return type to bool, adjust the argument to receive a MIDI byte as unsigned char, and adjust the comment accordingly. This allows callers to drop error checks, which simplifies the code. Meanwhile, snd_midi_event_encode() helper is used only in seq_midi.c, and it can be better folded into it. This will reduce the total amount of lines in the end. Signed-off-by: Takashi Iwai --- sound/core/seq/seq_virmidi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/core/seq/seq_virmidi.c') diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 03ac5e72dbe6..0c84926eb726 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -174,8 +174,8 @@ static void snd_vmidi_output_work(struct work_struct *work) while (READ_ONCE(vmidi->trigger)) { if (snd_rawmidi_transmit(substream, &input, 1) != 1) break; - if (snd_midi_event_encode_byte(vmidi->parser, input, - &vmidi->event) <= 0) + if (!snd_midi_event_encode_byte(vmidi->parser, input, + &vmidi->event)) continue; if (vmidi->event.type != SNDRV_SEQ_EVENT_NONE) { ret = snd_seq_kernel_client_dispatch(vmidi->client, -- cgit v1.2.3-59-g8ed1b