Re: [PATCH v5 8/8] r8152: Block future register access if register access fails

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

 



On Fri, Oct 20, 2023 at 02:06:59PM -0700, Douglas Anderson wrote:

...

> @@ -9603,25 +9713,14 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)
>  	return 0;
>  }
>  
> -static int rtl8152_probe(struct usb_interface *intf,
> -			 const struct usb_device_id *id)
> +static int rtl8152_probe_once(struct usb_interface *intf,
> +			      const struct usb_device_id *id, u8 version)
>  {
>  	struct usb_device *udev = interface_to_usbdev(intf);
>  	struct r8152 *tp;
>  	struct net_device *netdev;
> -	u8 version;
>  	int ret;
>  
> -	if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
> -		return -ENODEV;
> -
> -	if (!rtl_check_vendor_ok(intf))
> -		return -ENODEV;
> -
> -	version = rtl8152_get_version(intf);
> -	if (version == RTL_VER_UNKNOWN)
> -		return -ENODEV;
> -
>  	usb_reset_device(udev);
>  	netdev = alloc_etherdev(sizeof(struct r8152));
>  	if (!netdev) {
> @@ -9784,10 +9883,20 @@ static int rtl8152_probe(struct usb_interface *intf,
>  	else
>  		device_set_wakeup_enable(&udev->dev, false);
>  
> +	/* If we saw a control transfer error while probing then we may
> +	 * want to try probe() again. Consider this an error.
> +	 */
> +	if (test_bit(PROBE_SHOULD_RETRY, &tp->flags))
> +		goto out2;

Sorry for being a bit slow here, but if this is an error condition,
sould ret be set to an error value?

As flagged by Smatch.

> +
> +	set_bit(PROBED_WITH_NO_ERRORS, &tp->flags);
>  	netif_info(tp, probe, netdev, "%s\n", DRIVER_VERSION);
>  
>  	return 0;
>  
> +out2:
> +	unregister_netdev(netdev);
> +
>  out1:
>  	tasklet_kill(&tp->tx_tl);
>  	cancel_delayed_work_sync(&tp->hw_phy_work);

...




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

  Powered by Linux