aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-07-15 16:47:37 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 17:17:58 -0700
commitd25d5f28828708b81658cff6f676b710c7ee171d (patch)
treee20492d785070d2233763a3bf356c8d6a9ea7083 /drivers/usb
parent2cf69930f03af63731678de79cb1dbe3547a5938 (diff)
USB: qcserial: centralize probe exit path
Creating a common exit path from qcprobe to make it easier to extend it. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/qcserial.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 74e0b132af3..7556f343c0f 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -157,11 +157,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
dev_dbg(dev, "QDL port found\n");
- if (serial->interface->num_altsetting == 1) {
+ if (serial->interface->num_altsetting == 1)
retval = 0; /* Success */
- break;
- }
- altsetting = 1;
+ else
+ altsetting = 1;
}
break;
@@ -203,8 +202,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
default:
dev_err(dev, "unknown number of interfaces: %d\n", nintf);
- kfree(data);
- retval = -ENODEV;
}
if (altsetting >= 0) {
@@ -214,13 +211,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
- kfree(data);
}
}
- /* Set serial->private if not returning -ENODEV */
- if (retval != -ENODEV)
+ /* Set serial->private if not returning error */
+ if (retval == 0)
usb_set_serial_data(serial, data);
+ else
+ kfree(data);
+
return retval;
}