summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/metro-usb.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:00:11 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:00:11 -0800
commit8111e4ecf9373f6d76504416b0e76b18372f3598 (patch)
treea936712836b3e6cfa401989cc32e86e99180100d /drivers/usb/serial/metro-usb.c
parentdd63b0b4d6d036e1d5f7008c97c30789415489de (diff)
downloadlinux-8111e4ecf9373f6d76504416b0e76b18372f3598.tar.gz
linux-8111e4ecf9373f6d76504416b0e76b18372f3598.tar.xz
USB: serial: metro-usb: remove unneeded cast and function call
We should use kzalloc() instead of kmalloc() and memset(), and remove an unneeded void * cast as well. Cc: Aleksey Babahin <tamerlan311@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/metro-usb.c')
-rw-r--r--drivers/usb/serial/metro-usb.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index e968d3396813..6b7d2779148c 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -58,7 +58,7 @@ static bool debug;
static void metrousb_read_int_callback(struct urb *urb)
{
- struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
+ struct usb_serial_port *port = urb->context;
struct metrousb_private *metro_priv = usb_get_serial_port_data(port);
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
@@ -253,13 +253,10 @@ static int metrousb_startup(struct usb_serial *serial)
port = serial->port[i];
/* Declare memory. */
- metro_priv = kmalloc(sizeof(struct metrousb_private), GFP_KERNEL);
+ metro_priv = kzalloc(sizeof(struct metrousb_private), GFP_KERNEL);
if (!metro_priv)
return -ENOMEM;
- /* Clear memory. */
- memset(metro_priv, 0x00, sizeof(struct metrousb_private));
-
/* Initialize memory. */
spin_lock_init(&metro_priv->lock);
usb_set_serial_port_data(port, metro_priv);