aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/qcserial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/qcserial.c')
-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 74e0b132af3d..7556f343c0f3 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)
157 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { 157 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
158 dev_dbg(dev, "QDL port found\n"); 158 dev_dbg(dev, "QDL port found\n");
159 159
160 if (serial->interface->num_altsetting == 1) { 160 if (serial->interface->num_altsetting == 1)
161 retval = 0; /* Success */ 161 retval = 0; /* Success */
162 break; 162 else
163 } 163 altsetting = 1;
164 altsetting = 1;
165 } 164 }
166 break; 165 break;
167 166
@@ -203,8 +202,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
203 202
204 default: 203 default:
205 dev_err(dev, "unknown number of interfaces: %d\n", nintf); 204 dev_err(dev, "unknown number of interfaces: %d\n", nintf);
206 kfree(data);
207 retval = -ENODEV;
208 } 205 }
209 206
210 if (altsetting >= 0) { 207 if (altsetting >= 0) {
@@ -214,13 +211,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
214 "Could not set interface, error %d\n", 211 "Could not set interface, error %d\n",
215 retval); 212 retval);
216 retval = -ENODEV; 213 retval = -ENODEV;
217 kfree(data);
218 } 214 }
219 } 215 }
220 216
221 /* Set serial->private if not returning -ENODEV */ 217 /* Set serial->private if not returning error */
222 if (retval != -ENODEV) 218 if (retval == 0)
223 usb_set_serial_data(serial, data); 219 usb_set_serial_data(serial, data);
220 else
221 kfree(data);
222
224 return retval; 223 return retval;
225} 224}
226 225