lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87zfmbgno3.wl-tiwai@suse.de>
Date: Thu, 07 Nov 2024 14:48:28 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Colin Ian King <colin.i.king@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Takashi Iwai <tiwai@...e.de>,
	linux-usb@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] usb: gadget: function: remove redundant else statement

On Thu, 07 Nov 2024 14:33:48 +0100,
Colin Ian King wrote:
> 
> 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@...il.com>

Reviewed-by: Takashi Iwai <tiwai@...e.de>

Also worth to put the original discussion thread:

Link: https://lore.kernel.org/5f54ffd0-b5fe-4203-a626-c166becad362@gmail.com


thanks,

Takashi

> ---
>  drivers/usb/gadget/function/f_midi2.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
> index 8285df9ed6fd..5f3f6e7700c7 100644
> --- a/drivers/usb/gadget/function/f_midi2.c
> +++ b/drivers/usb/gadget/function/f_midi2.c
> @@ -1282,16 +1282,14 @@ static int f_midi2_set_alt(struct usb_function *fn, unsigned int intf,
>  
>  	if (intf != midi2->midi_if || alt > 1)
>  		return 0;
>  
>  	if (alt == 0)
>  		op_mode = MIDI_OP_MODE_MIDI1;
> -	else if (alt == 1)
> +	else
>  		op_mode = MIDI_OP_MODE_MIDI2;
> -	else
> -		op_mode = MIDI_OP_MODE_UNSET;
>  
>  	if (midi2->operation_mode == op_mode)
>  		return 0;
>  
>  	midi2->operation_mode = op_mode;
>  
> -- 
> 2.39.5
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ