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/bcm/InterfaceInit.c | |
parent | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (diff) |
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/bcm/InterfaceInit.c')
-rw-r--r-- | drivers/staging/bcm/InterfaceInit.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index eb246430b320..79058ce5b332 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -190,9 +190,9 @@ static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_devi } /* Allocate interface adapter structure */ - psIntfAdapter = kzalloc(sizeof(struct bcm_interface_adapter), GFP_KERNEL); + psIntfAdapter = kzalloc(sizeof(struct bcm_interface_adapter), + GFP_KERNEL); if (psIntfAdapter == NULL) { - dev_err(&udev->dev, DRV_NAME ": no memory for Interface adapter\n"); AdapterFree(psAdapter); return -ENOMEM; } @@ -564,11 +564,8 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->sIntrIn.int_in_interval = endpoint->bInterval; psIntfAdapter->sIntrIn.int_in_buffer = kmalloc(buffer_size, GFP_KERNEL); - if (!psIntfAdapter->sIntrIn.int_in_buffer) { - dev_err(&psIntfAdapter->udev->dev, - "could not allocate interrupt_in_buffer\n"); + if (!psIntfAdapter->sIntrIn.int_in_buffer) return -EINVAL; - } } if (!psIntfAdapter->sIntrOut.int_out_endpointAddr && bcm_usb_endpoint_is_int_out(endpoint)) { @@ -587,11 +584,8 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->sIntrOut.int_out_endpointAddr = endpoint->bEndpointAddress; psIntfAdapter->sIntrOut.int_out_interval = endpoint->bInterval; psIntfAdapter->sIntrOut.int_out_buffer = kmalloc(buffer_size, GFP_KERNEL); - if (!psIntfAdapter->sIntrOut.int_out_buffer) { - dev_err(&psIntfAdapter->udev->dev, - "could not allocate interrupt_out_buffer\n"); + if (!psIntfAdapter->sIntrOut.int_out_buffer) return -EINVAL; - } } } } |