diff mbox series

[net,2/2] net: usb: asix: Replace the direct return with goto statement

Message ID 20240407075513.923435-3-yiyang13@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add check for usbnet_get_endpoints and cleanup | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 942 this patch: 942
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 953 this patch: 953
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 953 this patch: 953
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 40 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-08--03-00 (tests: 956)

Commit Message

Yi Yang April 7, 2024, 7:55 a.m. UTC
Replace the direct return statement in ax88772_bind() with goto, to adhere
to the kernel coding style.

Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
 drivers/net/usb/asix_devices.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Paolo Abeni April 9, 2024, 8:57 a.m. UTC | #1
On Sun, 2024-04-07 at 07:55 +0000, Yi Yang wrote:
> Replace the direct return statement in ax88772_bind() with goto, to adhere
> to the kernel coding style.
> 
> Signed-off-by: Yi Yang <yiyang13@huawei.com>
> ---
>  drivers/net/usb/asix_devices.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index d8f86bafad6a..11417ed86d9e 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -838,7 +838,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  
>  	ret = usbnet_get_endpoints(dev, intf);
>  	if (ret)
> -		return ret;
> +		goto mdio_err;
>  
>  	/* Maybe the boot loader passed the MAC address via device tree */
>  	if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
> @@ -862,7 +862,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  		if (ret < 0) {
>  			netdev_dbg(dev->net, "Failed to read MAC address: %d\n",
>  				   ret);
> -			return ret;
> +			goto mdio_err;
>  		}
>  	}
>  
> @@ -875,7 +875,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  
>  	ret = asix_read_phy_addr(dev, true);
>  	if (ret < 0)
> -		return ret;
> +		goto mdio_err;
>  
>  	priv->phy_addr = ret;
>  	priv->embd_phy = ((priv->phy_addr & 0x1f) == AX_EMBD_PHY_ADDR);
> @@ -884,7 +884,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  			    &priv->chipcode, 0);
>  	if (ret < 0) {
>  		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
> -		return ret;
> +		goto mdio_err;
>  	}
>  
>  	priv->chipcode &= AX_CHIPCODE_MASK;
> @@ -899,7 +899,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
>  	ret = priv->reset(dev, 0);
>  	if (ret < 0) {
>  		netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret);
> -		return ret;
> +		goto mdio_err;
>  	}
>  
>  	/* Asix framing packs multiple eth frames into a 2K usb bulk transfer */

As noted by Simon in the previous submission, this kind of change
should target the 'net-next' tree, you can't bundle it in a 'net'
series. You have to submit the 'net' patch, get it merged, wait until
'net' is merged back into 'net-next' and then submit the 'net-next'
follow-up.

Please read Documentation/process/maintainer-netdev.rst for the gory
details.

Additionally, I would also suggest to drop instead the 'mdio_err'
label: there is little/no gain replacing a return statement with jump
to a return statement.

Cheers,

Paolo
diff mbox series

Patch

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index d8f86bafad6a..11417ed86d9e 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -838,7 +838,7 @@  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	ret = usbnet_get_endpoints(dev, intf);
 	if (ret)
-		return ret;
+		goto mdio_err;
 
 	/* Maybe the boot loader passed the MAC address via device tree */
 	if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
@@ -862,7 +862,7 @@  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 		if (ret < 0) {
 			netdev_dbg(dev->net, "Failed to read MAC address: %d\n",
 				   ret);
-			return ret;
+			goto mdio_err;
 		}
 	}
 
@@ -875,7 +875,7 @@  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	ret = asix_read_phy_addr(dev, true);
 	if (ret < 0)
-		return ret;
+		goto mdio_err;
 
 	priv->phy_addr = ret;
 	priv->embd_phy = ((priv->phy_addr & 0x1f) == AX_EMBD_PHY_ADDR);
@@ -884,7 +884,7 @@  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 			    &priv->chipcode, 0);
 	if (ret < 0) {
 		netdev_dbg(dev->net, "Failed to read STATMNGSTS_REG: %d\n", ret);
-		return ret;
+		goto mdio_err;
 	}
 
 	priv->chipcode &= AX_CHIPCODE_MASK;
@@ -899,7 +899,7 @@  static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 	ret = priv->reset(dev, 0);
 	if (ret < 0) {
 		netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret);
-		return ret;
+		goto mdio_err;
 	}
 
 	/* Asix framing packs multiple eth frames into a 2K usb bulk transfer */