diff options
author | Jan Safrata <jan.nikitenko@gmail.com> | 2012-05-22 08:04:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 20:26:11 -0400 |
commit | 0658a3366db7e27fa32c12e886230bb58c414c92 (patch) | |
tree | cadf90cab3dd5b508d0d48682f835fc87d938450 /drivers/usb | |
parent | 07828b10985393cd875eac1545fba47107e97bf9 (diff) |
usb: use usb_serial_put in usb_serial_probe errors
The use of kfree(serial) in error cases of usb_serial_probe
was invalid - usb_serial structure allocated in create_serial()
gets reference of usb_device that needs to be put, so we need
to use usb_serial_put() instead of simple kfree().
Signed-off-by: Jan Safrata <jan.nikitenko@gmail.com>
Acked-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6e8c527e07c9..27483f91a4a3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -757,7 +757,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
757 | 757 | ||
758 | if (retval) { | 758 | if (retval) { |
759 | dbg("sub driver rejected device"); | 759 | dbg("sub driver rejected device"); |
760 | kfree(serial); | 760 | usb_serial_put(serial); |
761 | module_put(type->driver.owner); | 761 | module_put(type->driver.owner); |
762 | return retval; | 762 | return retval; |
763 | } | 763 | } |
@@ -829,7 +829,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
829 | */ | 829 | */ |
830 | if (num_bulk_in == 0 || num_bulk_out == 0) { | 830 | if (num_bulk_in == 0 || num_bulk_out == 0) { |
831 | dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); | 831 | dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); |
832 | kfree(serial); | 832 | usb_serial_put(serial); |
833 | module_put(type->driver.owner); | 833 | module_put(type->driver.owner); |
834 | return -ENODEV; | 834 | return -ENODEV; |
835 | } | 835 | } |
@@ -843,7 +843,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
843 | if (num_ports == 0) { | 843 | if (num_ports == 0) { |
844 | dev_err(&interface->dev, | 844 | dev_err(&interface->dev, |
845 | "Generic device with no bulk out, not allowed.\n"); | 845 | "Generic device with no bulk out, not allowed.\n"); |
846 | kfree(serial); | 846 | usb_serial_put(serial); |
847 | module_put(type->driver.owner); | 847 | module_put(type->driver.owner); |
848 | return -EIO; | 848 | return -EIO; |
849 | } | 849 | } |