aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2014-03-12 14:09:37 -0400
committerGreg Kroah-Hartman <greg@kroah.com>2014-03-12 15:44:49 -0400
commitd7c933ae7da0d0b112bfc7e86424d780aaeb2d2c (patch)
tree17621c7eb8d4f2f052f2f43a6177b89eee950844
parentf61a7669f3986a0031c7cc780e2ccf2ec038ae33 (diff)
USB: cypress_m8: fix potential scheduling while atomic
Remove erroneous call to usb_clear_halt which is blocking and cannot be used in interrupt context. This code has possibly never been executed as it would cause an oops if it was. Simply treat a stalled-endpoint error as any other error condition. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-rw-r--r--drivers/usb/serial/cypress_m8.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index bccb1223143a..634f0d6605ed 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -1224,7 +1224,6 @@ static void cypress_write_int_callback(struct urb *urb)
1224 struct usb_serial_port *port = urb->context; 1224 struct usb_serial_port *port = urb->context;
1225 struct cypress_private *priv = usb_get_serial_port_data(port); 1225 struct cypress_private *priv = usb_get_serial_port_data(port);
1226 struct device *dev = &urb->dev->dev; 1226 struct device *dev = &urb->dev->dev;
1227 int result;
1228 int status = urb->status; 1227 int status = urb->status;
1229 1228
1230 switch (status) { 1229 switch (status) {
@@ -1239,21 +1238,9 @@ static void cypress_write_int_callback(struct urb *urb)
1239 __func__, status); 1238 __func__, status);
1240 priv->write_urb_in_use = 0; 1239 priv->write_urb_in_use = 0;
1241 return; 1240 return;
1242 case -EPIPE: /* no break needed; clear halt and resubmit */ 1241 case -EPIPE:
1243 if (!priv->comm_is_ok) 1242 /* Cannot call usb_clear_halt while in_interrupt */
1244 break; 1243 /* FALLTHROUGH */
1245 usb_clear_halt(port->serial->dev, 0x02);
1246 /* error in the urb, so we have to resubmit it */
1247 dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
1248 __func__, status);
1249 port->interrupt_out_urb->transfer_buffer_length = 1;
1250 result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
1251 if (!result)
1252 return;
1253 dev_err(dev, "%s - failed resubmitting write urb, error %d\n",
1254 __func__, result);
1255 cypress_set_dead(port);
1256 break;
1257 default: 1244 default:
1258 dev_err(dev, "%s - unexpected nonzero write status received: %d\n", 1245 dev_err(dev, "%s - unexpected nonzero write status received: %d\n",
1259 __func__, status); 1246 __func__, status);