aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2011-11-10 08:58:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-15 13:47:42 -0500
commit2479e2a9c05899bd8789f8bd48565641806120aa (patch)
tree449cd0e3aac6625bf3ffa2c4c9deb1610de1f282
parent06946a66546aedfc5192645e8fc56081441e378c (diff)
USB: cp210x: forward USB errors to USB serial core
Make sure we forward all error codes (e.g. ENOMEM) to USB serial core. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/cp210x.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index b1e5db161487..7175bb107dec 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -280,7 +280,10 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
280 dbg("%s - Unable to send config request, " 280 dbg("%s - Unable to send config request, "
281 "request=0x%x size=%d result=%d\n", 281 "request=0x%x size=%d result=%d\n",
282 __func__, request, size, result); 282 __func__, request, size, result);
283 return -EPROTO; 283 if (result > 0)
284 result = -EPROTO;
285
286 return result;
284 } 287 }
285 288
286 return 0; 289 return 0;
@@ -331,7 +334,10 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
331 dbg("%s - Unable to send request, " 334 dbg("%s - Unable to send request, "
332 "request=0x%x size=%d result=%d\n", 335 "request=0x%x size=%d result=%d\n",
333 __func__, request, size, result); 336 __func__, request, size, result);
334 return -EPROTO; 337 if (result > 0)
338 result = -EPROTO;
339
340 return result;
335 } 341 }
336 342
337 return 0; 343 return 0;
@@ -395,10 +401,11 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
395 401
396 dbg("%s - port %d", __func__, port->number); 402 dbg("%s - port %d", __func__, port->number);
397 403
398 if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) { 404 result = cp210x_set_config_single(port, CP210X_IFC_ENABLE,
399 dev_err(&port->dev, "%s - Unable to enable UART\n", 405 UART_ENABLE);
400 __func__); 406 if (result) {
401 return -EPROTO; 407 dev_err(&port->dev, "%s - Unable to enable UART\n", __func__);
408 return result;
402 } 409 }
403 410
404 result = usb_serial_generic_open(tty, port); 411 result = usb_serial_generic_open(tty, port);