diff options
author | Joe Perches <joe@perches.com> | 2013-02-11 09:41:29 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-11 10:10:33 -0800 |
commit | 78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b (patch) | |
tree | 6534f66eb765163602ad1af98c651bea6ae09416 /drivers/staging/frontier/tranzport.c | |
parent | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (diff) | |
download | linux-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.tar.bz2 |
staging: Remove unnecessary OOM messages
alloc failures already get standardized OOM
messages and a dump_stack.
For the affected mallocs around these OOM messages:
Converted kzallocs with multiplies to kcalloc.
Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/strlen/strncpy to kstrdup.
Moved a spin_lock below a removed OOM message and
removed a now unnecessary spin_unlock.
Neatened alignment and whitespace.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/frontier/tranzport.c')
-rw-r--r-- | drivers/staging/frontier/tranzport.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 5196a4e053e6..04b5e66d9861 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c @@ -803,10 +803,9 @@ static int usb_tranzport_probe(struct usb_interface *intf, /* allocate memory for our device state and initialize it */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { - dev_err(&intf->dev, "Out of memory\n"); + if (dev == NULL) goto exit; - } + mutex_init(&dev->mtx); dev->intf = intf; init_waitqueue_head(&dev->read_wait); @@ -848,18 +847,14 @@ static int usb_tranzport_probe(struct usb_interface *intf, dev->ring_buffer = kmalloc((true_size * sizeof(struct tranzport_cmd)) + 8, GFP_KERNEL); - - if (!dev->ring_buffer) { - dev_err(&intf->dev, - "Couldn't allocate ring_buffer size %d\n", true_size); + if (!dev->ring_buffer) goto error; - } + dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); - if (!dev->interrupt_in_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n"); + if (!dev->interrupt_in_buffer) goto error; - } + dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_in_urb) { dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); @@ -875,12 +870,11 @@ static int usb_tranzport_probe(struct usb_interface *intf, "Interrupt out endpoint size is not 8!)\n"); dev->interrupt_out_buffer = - kmalloc(write_buffer_size * dev->interrupt_out_endpoint_size, - GFP_KERNEL); - if (!dev->interrupt_out_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); + kmalloc_array(write_buffer_size, + dev->interrupt_out_endpoint_size, GFP_KERNEL); + if (!dev->interrupt_out_buffer) goto error; - } + dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_out_urb) { dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n"); |