[PATCH] pl2303 - unplug device.
It's possible to unplug usb device and do tiocmset() and tiocmget() without valid interface in pl2303 module. The patch below check this and return -ENODEV if interface was removed. From: Flavio Leitner <fbl@conectiva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> diff -purN linux-05-04-11/drivers/usb/serial/pl2303.c linux-05-04-11.usb/drivers/usb/serial/pl2303.c
This commit is contained in:
@@ -677,6 +677,9 @@ static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u8 control;
|
u8 control;
|
||||||
|
|
||||||
|
if (!usb_get_intfdata(port->serial->interface))
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
spin_lock_irqsave (&priv->lock, flags);
|
spin_lock_irqsave (&priv->lock, flags);
|
||||||
if (set & TIOCM_RTS)
|
if (set & TIOCM_RTS)
|
||||||
priv->line_control |= CONTROL_RTS;
|
priv->line_control |= CONTROL_RTS;
|
||||||
@@ -702,6 +705,9 @@ static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file)
|
|||||||
|
|
||||||
dbg("%s (%d)", __FUNCTION__, port->number);
|
dbg("%s (%d)", __FUNCTION__, port->number);
|
||||||
|
|
||||||
|
if (!usb_get_intfdata(port->serial->interface))
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
spin_lock_irqsave (&priv->lock, flags);
|
spin_lock_irqsave (&priv->lock, flags);
|
||||||
mcr = priv->line_control;
|
mcr = priv->line_control;
|
||||||
status = priv->line_status;
|
status = priv->line_status;
|
||||||
|
Reference in New Issue
Block a user