Re: [PATCH -next] net: usb: asix: Add check for usbnet_get_endpoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-04-02 at 11:30 +0000, Yi Yang wrote:
> Add check for usbnet_get_endpoints() and return the error if it fails
> in order to transfer the error.
> 
> Signed-off-by: Yi Yang <yiyang13@xxxxxxxxxx>

I agree with Simon, this should be a net patch, with a suitable 'fixes'
tag.

> ---
>  drivers/net/usb/asix_devices.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index f7cff58fe044..11417ed86d9e 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)
> +		goto mdio_err;

You can simply do
		return ret;

here

>  
>  	/* Maybe the boot loader passed the MAC address via device tree */
>  	if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
> @@ -858,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;

This chunk is not needed and does not change the driver behavior, as
the only statement after the 'mdio_err' label is:

	return ret;

Please, drop this chunk and the similar 3 below.

Cheers,

Paolo






[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux