]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: gadget: function: remove redundant else statement
authorColin Ian King <colin.i.king@gmail.com>
Thu, 7 Nov 2024 13:33:48 +0000 (13:33 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2024 10:06:40 +0000 (11:06 +0100)
After an initial range change on the insigned int alt being > 1
the only possible values for alt are 0 or 1. Therefore the else
statement for values other than 0 or 1 is redundant and can be
removed. Replace the else if (all == 1) check with just an else.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/5f54ffd0-b5fe-4203-a626-c166becad362@gmail.com
Link: https://lore.kernel.org/r/20241107133348.22762-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_midi2.c

index 8285df9ed6fd781bf6fb1ec2d0c5b27145f6fffb..ee3d9e3578f791bd14393da3b9074b11ecd9023d 100644 (file)
@@ -1285,10 +1285,8 @@ static int f_midi2_set_alt(struct usb_function *fn, unsigned int intf,
 
        if (alt == 0)
                op_mode = MIDI_OP_MODE_MIDI1;
-       else if (alt == 1)
-               op_mode = MIDI_OP_MODE_MIDI2;
        else
-               op_mode = MIDI_OP_MODE_UNSET;
+               op_mode = MIDI_OP_MODE_MIDI2;
 
        if (midi2->operation_mode == op_mode)
                return 0;