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] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025111941-okay-dry-1b18@gregkh>
Date: Wed, 19 Nov 2025 16:25:44 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Clint George <clintbgeorge@...il.com>
Cc: stern@...land.harvard.edu, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, david.hunter.linux@...il.com,
	linux-kernel-mentees@...ts.linux.dev, skhan@...uxfoundation.org,
	khalid@...nel.org
Subject: Re: [PATCH 7/8] usb: gadget: dummy_hcd: remove unnecessary 'else'
 after return

On Wed, Nov 19, 2025 at 06:38:39PM +0530, Clint George wrote:
> The 'else' after a return statement is redundant and unnecessary.
> This patch removes the 'else' in dummy_set_halt_and_wedge(), making
> the code clearer and compliant with kernel coding style:
> 
> - Return early for the -EAGAIN condition.
> - Place the subsequent code at the same indentation level instead
>   of inside an 'else' block.

When you have to list different things in a commit changelog, that is a
HUGE hint it should be multiple patches :(

> 
> Signed-off-by: Clint George <clintbgeorge@...il.com>
> ---
>  drivers/usb/gadget/udc/dummy_hcd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 1840dd822..1114dfe61 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -803,10 +803,10 @@ dummy_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged)
>  		return -ESHUTDOWN;
>  	if (!value)
>  		ep->halted = ep->wedged = 0;
> -	else if (ep->desc && (ep->desc->bEndpointAddress & USB_DIR_IN) &&
> -			!list_empty(&ep->queue))
> -		return -EAGAIN;
>  	else {
> +		if (ep->desc && (ep->desc->bEndpointAddress & USB_DIR_IN) &&
> +			!list_empty(&ep->queue))
> +			return -EAGAIN;

Wait, what?  Why move this around like this, the original is best and
makes more sense.  This version is much harder to read :(

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ