public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] Add check for usbnet_get_endpoints and cleanup
@ 2024-04-07  7:55 Yi Yang
  2024-04-07  7:55 ` [PATCH net 1/2] net: usb: asix: Add check for usbnet_get_endpoints Yi Yang
  2024-04-07  7:55 ` [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement Yi Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Yi Yang @ 2024-04-07  7:55 UTC (permalink / raw)
  To: horms, davem, edumazet, kuba, pabeni, nichen
  Cc: linux-usb, netdev, stable, wangweiyang2

I split before patch to two patch. one for bugfix, anorther one for cleanup

Yi Yang (2):
  net: usb: asix: Add check for usbnet_get_endpoints
  net: usb: asix: Replace the direct return with goto statement

 drivers/net/usb/asix_devices.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/2] net: usb: asix: Add check for usbnet_get_endpoints
  2024-04-07  7:55 [PATCH net 0/2] Add check for usbnet_get_endpoints and cleanup Yi Yang
@ 2024-04-07  7:55 ` Yi Yang
  2024-04-07  7:55 ` [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement Yi Yang
  1 sibling, 0 replies; 5+ messages in thread
From: Yi Yang @ 2024-04-07  7:55 UTC (permalink / raw)
  To: horms, davem, edumazet, kuba, pabeni, nichen
  Cc: linux-usb, netdev, stable, wangweiyang2

Add check for usbnet_get_endpoints() and return the error if it fails
in order to transfer the error.

Cc: stable@vger.kernel.org
Fixes: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Fixes: 4ad1438f025e ("NET: fix phy init for AX88772 USB ethernet")
Fixes: 933a27d39e0e ("USB: asix - Add AX88178 support and many other changes")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
 drivers/net/usb/asix_devices.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index f7cff58fe044..d8f86bafad6a 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 	int i;
 	unsigned long gpio_bits = dev->driver_info->data;
 
-	usbnet_get_endpoints(dev,intf);
+	ret = usbnet_get_endpoints(dev, intf);
+	if (ret)
+		goto out;
 
 	/* Toggle the GPIOs in a manufacturer/model specific way */
 	for (i = 2; i >= 0; i--) {
@@ -834,7 +836,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	dev->driver_priv = priv;
 
-	usbnet_get_endpoints(dev, intf);
+	ret = usbnet_get_endpoints(dev, intf);
+	if (ret)
+		return ret;
 
 	/* Maybe the boot loader passed the MAC address via device tree */
 	if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
@@ -1258,7 +1262,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 	int ret;
 	u8 buf[ETH_ALEN] = {0};
 
-	usbnet_get_endpoints(dev,intf);
+	ret = usbnet_get_endpoints(dev, intf);
+	if (ret)
+		return ret;
 
 	/* Get the MAC address */
 	ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement
  2024-04-07  7:55 [PATCH net 0/2] Add check for usbnet_get_endpoints and cleanup Yi Yang
  2024-04-07  7:55 ` [PATCH net 1/2] net: usb: asix: Add check for usbnet_get_endpoints Yi Yang
@ 2024-04-07  7:55 ` Yi Yang
  2024-04-07  7:59   ` kernel test robot
  2024-04-09  8:57   ` Paolo Abeni
  1 sibling, 2 replies; 5+ messages in thread
From: Yi Yang @ 2024-04-07  7:55 UTC (permalink / raw)
  To: horms, davem, edumazet, kuba, pabeni, nichen
  Cc: linux-usb, netdev, stable, wangweiyang2

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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement
  2024-04-07  7:55 ` [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement Yi Yang
@ 2024-04-07  7:59   ` kernel test robot
  2024-04-09  8:57   ` Paolo Abeni
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-04-07  7:59 UTC (permalink / raw)
  To: Yi Yang; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement
Link: https://lore.kernel.org/stable/20240407075513.923435-3-yiyang13%40huawei.com

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement
  2024-04-07  7:55 ` [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement Yi Yang
  2024-04-07  7:59   ` kernel test robot
@ 2024-04-09  8:57   ` Paolo Abeni
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2024-04-09  8:57 UTC (permalink / raw)
  To: Yi Yang, horms, davem, edumazet, kuba, nichen
  Cc: linux-usb, netdev, stable, wangweiyang2

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-09  8:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-07  7:55 [PATCH net 0/2] Add check for usbnet_get_endpoints and cleanup Yi Yang
2024-04-07  7:55 ` [PATCH net 1/2] net: usb: asix: Add check for usbnet_get_endpoints Yi Yang
2024-04-07  7:55 ` [PATCH net 2/2] net: usb: asix: Replace the direct return with goto statement Yi Yang
2024-04-07  7:59   ` kernel test robot
2024-04-09  8:57   ` Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox