Commit 6ce8213b authored by Hans de Goede's avatar Hans de Goede Committed by Sarah Sharp

uas: Properly set interface to altsetting 0 on probe failure

- Rename labels to properly reflect this
- Don't skip free-ing the streams when scsi_init_shared_tag_map fails
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent d5f808d3
...@@ -993,8 +993,8 @@ static void uas_free_streams(struct uas_dev_info *devinfo) ...@@ -993,8 +993,8 @@ static void uas_free_streams(struct uas_dev_info *devinfo)
*/ */
static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ {
int result; int result = -ENOMEM;
struct Scsi_Host *shost; struct Scsi_Host *shost = NULL;
struct uas_dev_info *devinfo; struct uas_dev_info *devinfo;
struct usb_device *udev = interface_to_usbdev(intf); struct usb_device *udev = interface_to_usbdev(intf);
...@@ -1003,12 +1003,11 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1003,12 +1003,11 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
devinfo = kmalloc(sizeof(struct uas_dev_info), GFP_KERNEL); devinfo = kmalloc(sizeof(struct uas_dev_info), GFP_KERNEL);
if (!devinfo) if (!devinfo)
return -ENOMEM; goto set_alt0;
result = -ENOMEM;
shost = scsi_host_alloc(&uas_host_template, sizeof(void *)); shost = scsi_host_alloc(&uas_host_template, sizeof(void *));
if (!shost) if (!shost)
goto free; goto set_alt0;
shost->max_cmd_len = 16 + 252; shost->max_cmd_len = 16 + 252;
shost->max_id = 1; shost->max_id = 1;
...@@ -1030,11 +1029,11 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1030,11 +1029,11 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
result = scsi_init_shared_tag_map(shost, devinfo->qdepth - 3); result = scsi_init_shared_tag_map(shost, devinfo->qdepth - 3);
if (result) if (result)
goto free; goto free_streams;
result = scsi_add_host(shost, &intf->dev); result = scsi_add_host(shost, &intf->dev);
if (result) if (result)
goto deconfig_eps; goto free_streams;
shost->hostdata[0] = (unsigned long)devinfo; shost->hostdata[0] = (unsigned long)devinfo;
...@@ -1042,9 +1041,10 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1042,9 +1041,10 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
usb_set_intfdata(intf, shost); usb_set_intfdata(intf, shost);
return result; return result;
deconfig_eps: free_streams:
uas_free_streams(devinfo); uas_free_streams(devinfo);
free: set_alt0:
usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0);
kfree(devinfo); kfree(devinfo);
if (shost) if (shost)
scsi_host_put(shost); scsi_host_put(shost);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment