From 5cbded585d129d0226cb48ac4202b253c781be26 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Wed, 13 Dec 2006 00:35:56 -0800 Subject: [PATCH] getting rid of all casts of k[cmz]alloc() calls Run this: #!/bin/sh for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do echo "De-casting $f..." perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f done And then go through and reinstate those cases where code is casting pointers to non-pointers. And then drop a few hunks which conflicted with outstanding work. Cc: Russell King , Ian Molton Cc: Mikael Starvik Cc: Yoshinori Sato Cc: Roman Zippel Cc: Geert Uytterhoeven Cc: Ralf Baechle Cc: Paul Mackerras Cc: Kyle McMartin Cc: Benjamin Herrenschmidt Cc: Martin Schwidefsky Cc: "David S. Miller" Cc: Jeff Dike Cc: Greg KH Cc: Jens Axboe Cc: Paul Fulghum Cc: Alan Cox Cc: Karsten Keil Cc: Mauro Carvalho Chehab Cc: Jeff Garzik Cc: James Bottomley Cc: Ian Kent Cc: Steven French Cc: David Woodhouse Cc: Neil Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/usb/serial/cypress_m8.c | 2 +- drivers/usb/serial/digi_acceleport.c | 4 ++-- drivers/usb/serial/io_ti.c | 2 +- drivers/usb/serial/ipaq.c | 2 +- drivers/usb/serial/kobil_sct.c | 4 ++-- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- drivers/usb/serial/whiteheat.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/usb/serial') diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index a1fdb85b8c0a..45cdf9bc43b2 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -1493,7 +1493,7 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size) if (size == 0) return NULL; - cb = (struct cypress_buf *)kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); + cb = kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); if (cb == NULL) return NULL; diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 9d9ea874639c..efd9ce3f931f 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1681,7 +1681,7 @@ dbg( "digi_startup: TOP" ); for( i=0; itype->num_ports+1; i++ ) { /* allocate port private structure */ - priv = (struct digi_port *)kmalloc( sizeof(struct digi_port), + priv = kmalloc( sizeof(struct digi_port), GFP_KERNEL ); if( priv == (struct digi_port *)0 ) { while( --i >= 0 ) @@ -1714,7 +1714,7 @@ dbg( "digi_startup: TOP" ); } /* allocate serial private structure */ - serial_priv = (struct digi_serial *)kmalloc( sizeof(struct digi_serial), + serial_priv = kmalloc( sizeof(struct digi_serial), GFP_KERNEL ); if( serial_priv == (struct digi_serial *)0 ) { for( i=0; itype->num_ports+1; i++ ) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 2da2684e0809..980285c0233a 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2811,7 +2811,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size) if (size == 0) return NULL; - eb = (struct edge_buf *)kmalloc(sizeof(struct edge_buf), GFP_KERNEL); + eb = kmalloc(sizeof(struct edge_buf), GFP_KERNEL); if (eb == NULL) return NULL; diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index d72cf8bc7f76..42f757a5b876 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -595,7 +595,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) bytes_in = 0; bytes_out = 0; - priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); + priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); if (priv == NULL) { err("%s - Out of memory", __FUNCTION__); return -ENOMEM; diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index e284d6c0fd35..62bea0c923bd 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -269,7 +269,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) } // allocate memory for write_urb transfer buffer - port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); + port->write_urb->transfer_buffer = kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); if (! port->write_urb->transfer_buffer) { kfree(transfer_buffer); usb_free_urb(port->write_urb); @@ -696,7 +696,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, return 0; case TCFLSH: // 0x540B - transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); + transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); if (! transfer_buffer) { return -ENOBUFS; } diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index d124d780e42e..5dc2ac9afa90 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -159,7 +159,7 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size) if (size == 0) return NULL; - pb = (struct pl2303_buf *)kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL); + pb = kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL); if (pb == NULL) return NULL; diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index f42eb9ea6405..83189005c6fb 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -1710,7 +1710,7 @@ static struct circ_buf *ti_buf_alloc(void) { struct circ_buf *cb; - cb = (struct circ_buf *)kmalloc(sizeof(struct circ_buf), GFP_KERNEL); + cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL); if (cb == NULL) return NULL; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index dc45e58e2b8c..5483d8564c1b 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -416,7 +416,7 @@ static int whiteheat_attach (struct usb_serial *serial) for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; - info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); + info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); if (info == NULL) { err("%s: Out of memory for port structures\n", serial->type->description); goto no_private; @@ -487,7 +487,7 @@ static int whiteheat_attach (struct usb_serial *serial) usb_set_serial_port_data(port, info); } - command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); + command_info = kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); if (command_info == NULL) { err("%s: Out of memory for port structures\n", serial->type->description); goto no_command_private; -- cgit v1.2.3