summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 12:37:28 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:52:27 -0700
commit0a967f62e6623a2a7bb3a5707352b6667c0c649e (patch)
tree36062f0011219bda87653d32e7f180e25dcaef4e
parent8413d2fd80a8e1f09a37c371610a89618980b08f (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>
-rw-r--r--drivers/usb/serial/spcp8x5.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 5779dd819d3..e0093dd2223 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)
{
struct spcp8x5_private *priv = usb_get_serial_port_data(port);
struct usb_device *dev = port->serial->dev;
- u8 *status_buffer;
+ u8 *buf;
int ret;
/* I return Permited not support here but seem inval device
* is more fix */
if (priv->type == SPCP825_007_TYPE)
return -EPERM;
- if (status == NULL)
- return -EINVAL;
- status_buffer = kmalloc(1, GFP_KERNEL);
- if (!status_buffer)
+ buf = kzalloc(1, GFP_KERNEL);
+ if (!buf)
return -ENOMEM;
- status_buffer[0] = status[0];
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
GET_UART_STATUS, GET_UART_STATUS_TYPE,
- 0, GET_UART_STATUS_MSR, status_buffer, 1, 100);
+ 0, GET_UART_STATUS_MSR, buf, 1, 100);
if (ret < 0)
dev_err(&port->dev, "failed to get modem status: %d", ret);
- dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x", ret, *status_buffer);
-
- status[0] = status_buffer[0];
- kfree(status_buffer);
+ dev_dbg(&port->dev, "0xc0:0x22:0:6 %d - 0x02%x", ret, *buf);
+ *status = *buf;
+ kfree(buf);
return ret;
}