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: <20241210185559.12b9e03c@kernel.org>
Date: Tue, 10 Dec 2024 18:55:59 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Woojung Huh
 <woojung.huh@...rochip.com>, Andrew Lunn <andrew+netdev@...n.ch>,
 kernel@...gutronix.de, linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, UNGLinuxDriver@...rochip.com, Phil Elwell
 <phil@...pberrypi.org>
Subject: Re: [PATCH net-next v1 08/11] net: usb: lan78xx: Use
 function-specific label in lan78xx_mac_reset

On Mon,  9 Dec 2024 14:07:48 +0100 Oleksij Rempel wrote:
> Rename the generic `done` label to the function-specific
> `mac_reset_done` label in `lan78xx_mac_reset`. This improves clarity and
> aligns with best practices for error handling and cleanup labels.

What rules do you refer to?
AFAIK the best practice for exits is to name the label after what
you're jumping to. In this case I'd use exit_unlock.

> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index c66e404f51ac..fdeb95db529b 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1604,16 +1604,16 @@ static int lan78xx_mac_reset(struct lan78xx_net *dev)
>  	 */
>  	ret = lan78xx_phy_wait_not_busy(dev);
>  	if (ret < 0)
> -		goto done;
> +		goto mac_reset_done;

...

>  	ret = -ETIMEDOUT;
> -done:
> +mac_reset_done:
>  	mutex_unlock(&dev->phy_mutex);
>  
>  	return ret;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ