diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-10-18 04:52:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-18 11:08:47 -0400 |
commit | 0978c9499944d0670338fd048a3bdb1624dc66dc (patch) | |
tree | a5ca540c1345ab7a7694c82381901d56394ac46e /drivers/usb | |
parent | bf90ff5f3b8f67e5b42df4ea4fd543f8010a2676 (diff) |
USB: iuu_phoenix: fix sysfs-attribute creation
Make sure sysfs attributes are created at port probe.
A recent patch ("USB: iuu_phoenix: fix port-data memory leak") removed
the sysfs-attribute creation by mistake.
Reported-by: Yuanhan Liu <yuanhan.liu@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-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/iuu_phoenix.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 959f71e31dc..cd5533e81de 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -53,6 +53,8 @@ static int iuu_cardout; | |||
53 | static bool xmas; | 53 | static bool xmas; |
54 | static int vcc_default = 5; | 54 | static int vcc_default = 5; |
55 | 55 | ||
56 | static int iuu_create_sysfs_attrs(struct usb_serial_port *port); | ||
57 | static int iuu_remove_sysfs_attrs(struct usb_serial_port *port); | ||
56 | static void read_rxcmd_callback(struct urb *urb); | 58 | static void read_rxcmd_callback(struct urb *urb); |
57 | 59 | ||
58 | struct iuu_private { | 60 | struct iuu_private { |
@@ -75,6 +77,7 @@ struct iuu_private { | |||
75 | static int iuu_port_probe(struct usb_serial_port *port) | 77 | static int iuu_port_probe(struct usb_serial_port *port) |
76 | { | 78 | { |
77 | struct iuu_private *priv; | 79 | struct iuu_private *priv; |
80 | int ret; | ||
78 | 81 | ||
79 | priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); | 82 | priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); |
80 | if (!priv) | 83 | if (!priv) |
@@ -99,6 +102,14 @@ static int iuu_port_probe(struct usb_serial_port *port) | |||
99 | 102 | ||
100 | usb_set_serial_port_data(port, priv); | 103 | usb_set_serial_port_data(port, priv); |
101 | 104 | ||
105 | ret = iuu_create_sysfs_attrs(port); | ||
106 | if (ret) { | ||
107 | kfree(priv->writebuf); | ||
108 | kfree(priv->buf); | ||
109 | kfree(priv); | ||
110 | return ret; | ||
111 | } | ||
112 | |||
102 | return 0; | 113 | return 0; |
103 | } | 114 | } |
104 | 115 | ||
@@ -106,6 +117,7 @@ static int iuu_port_remove(struct usb_serial_port *port) | |||
106 | { | 117 | { |
107 | struct iuu_private *priv = usb_get_serial_port_data(port); | 118 | struct iuu_private *priv = usb_get_serial_port_data(port); |
108 | 119 | ||
120 | iuu_remove_sysfs_attrs(port); | ||
109 | kfree(priv->writebuf); | 121 | kfree(priv->writebuf); |
110 | kfree(priv->buf); | 122 | kfree(priv->buf); |
111 | kfree(priv); | 123 | kfree(priv); |
@@ -1197,8 +1209,6 @@ static struct usb_serial_driver iuu_device = { | |||
1197 | .num_ports = 1, | 1209 | .num_ports = 1, |
1198 | .bulk_in_size = 512, | 1210 | .bulk_in_size = 512, |
1199 | .bulk_out_size = 512, | 1211 | .bulk_out_size = 512, |
1200 | .port_probe = iuu_create_sysfs_attrs, | ||
1201 | .port_remove = iuu_remove_sysfs_attrs, | ||
1202 | .open = iuu_open, | 1212 | .open = iuu_open, |
1203 | .close = iuu_close, | 1213 | .close = iuu_close, |
1204 | .write = iuu_uart_write, | 1214 | .write = iuu_uart_write, |