summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/bus.c')
-rw-r--r--drivers/usb/serial/bus.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index eb0195cf37dd..7133818a58b9 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -16,19 +16,13 @@
static int usb_serial_device_match(struct device *dev,
struct device_driver *drv)
{
- struct usb_serial_driver *driver;
- const struct usb_serial_port *port;
+ const struct usb_serial_port *port = to_usb_serial_port(dev);
+ struct usb_serial_driver *driver = to_usb_serial_driver(drv);
/*
* drivers are already assigned to ports in serial_probe so it's
* a simple check here.
*/
- port = to_usb_serial_port(dev);
- if (!port)
- return 0;
-
- driver = to_usb_serial_driver(drv);
-
if (driver == port->serial->type)
return 1;
@@ -37,16 +31,12 @@ static int usb_serial_device_match(struct device *dev,
static int usb_serial_device_probe(struct device *dev)
{
+ struct usb_serial_port *port = to_usb_serial_port(dev);
struct usb_serial_driver *driver;
- struct usb_serial_port *port;
struct device *tty_dev;
int retval = 0;
int minor;
- port = to_usb_serial_port(dev);
- if (!port)
- return -ENODEV;
-
/* make sure suspend/resume doesn't race against port_probe */
retval = usb_autopm_get_interface(port->serial->interface);
if (retval)
@@ -86,16 +76,11 @@ err_autopm_put:
static int usb_serial_device_remove(struct device *dev)
{
+ struct usb_serial_port *port = to_usb_serial_port(dev);
struct usb_serial_driver *driver;
- struct usb_serial_port *port;
- int retval = 0;
int minor;
int autopm_err;
- port = to_usb_serial_port(dev);
- if (!port)
- return -ENODEV;
-
/*
* Make sure suspend/resume doesn't race against port_remove.
*
@@ -109,7 +94,7 @@ static int usb_serial_device_remove(struct device *dev)
driver = port->serial->type;
if (driver->port_remove)
- retval = driver->port_remove(port);
+ driver->port_remove(port);
dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
driver->description, minor);
@@ -117,7 +102,7 @@ static int usb_serial_device_remove(struct device *dev)
if (!autopm_err)
usb_autopm_put_interface(port->serial->interface);
- return retval;
+ return 0;
}
static ssize_t new_id_store(struct device_driver *driver,