diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-03-21 07:37:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-25 16:52:27 -0400 |
commit | 0a967f62e6623a2a7bb3a5707352b6667c0c649e (patch) | |
tree | 36062f0011219bda87653d32e7f180e25dcaef4e /drivers/usb/serial/spcp8x5.c | |
parent | 8413d2fd80a8e1f09a37c371610a89618980b08f (diff) |
USB: spcp8x5: clean up modem status retrieval
Clean up modem status retrieval.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/spcp8x5.c')
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 5779dd819d31..e0093dd22238 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -226,31 +226,27 @@ static int spcp8x5_get_msr(struct usb_serial_port *port, u8 *status) | |||
226 | { | 226 | { |
227 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 227 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
228 | struct usb_device *dev = port->serial->dev; | 228 | struct usb_device *dev = port->serial->dev; |
229 | u8 *status_buffer; | 229 | u8 *buf; |
230 | int ret; | 230 | int ret; |
231 | 231 | ||
232 | /* I return Permited not support here but seem inval device | 232 | /* I return Permited not support here but seem inval device |
233 | * is more fix */ | 233 | * is more fix */ |
234 | if (priv->type == SPCP825_007_TYPE) | 234 | if (priv->type == SPCP825_007_TYPE) |
235 | return -EPERM; | 235 | return -EPERM; |
236 | if (status == NULL) | ||
237 | return -EINVAL; | ||
238 | 236 | ||
239 | status_buffer = kmalloc(1, GFP_KERNEL); | 237 | buf = kzalloc(1, GFP_KERNEL); |
240 | if (!status_buffer) | 238 | if (!buf) |
241 | return -ENOMEM; | 239 | return -ENOMEM; |
242 | status_buffer[0] = status[0]; | ||
243 | 240 | ||
244 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | 241 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), |
245 | GET_UART_STATUS, GET_UART_STATUS_TYPE, | 242 | GET_UART_STATUS, GET_UART_STATUS_TYPE, |
246 | 0, GET_UART_STATUS_MSR, status_buffer, 1, 100); | 243 | 0, GET_UART_STATUS_MSR, buf, 1, 100); |
247 | if (ret < 0) | 244 | if (ret < 0) |
248 | dev_err(&port->dev, "failed to get modem status: %d", ret); | 245 | dev_err(&port->dev, "failed to get modem status: %d", ret); |
249 | 246 | ||
250 | dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x", ret, *status_buffer); | 247 | dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x", ret, *buf); |
251 | 248 | *status = *buf; | |
252 | status[0] = status_buffer[0]; | 249 | kfree(buf); |
253 | kfree(status_buffer); | ||
254 | 250 | ||
255 | return ret; | 251 | return ret; |
256 | } | 252 | } |