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/usbip | |
parent | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (diff) | |
download | op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.zip op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.tar.gz |
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/usbip')
-rw-r--r-- | drivers/staging/usbip/stub_dev.c | 4 | ||||
-rw-r--r-- | drivers/staging/usbip/stub_rx.c | 1 | ||||
-rw-r--r-- | drivers/staging/usbip/stub_tx.c | 1 | ||||
-rw-r--r-- | drivers/staging/usbip/vhci_hcd.c | 8 |
4 files changed, 3 insertions, 11 deletions
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index d36c69e..ca5de9d 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -286,10 +286,8 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev, /* yes, it's a new device */ sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL); - if (!sdev) { - dev_err(&interface->dev, "no memory for stub_device\n"); + if (!sdev) return NULL; - } sdev->interface = usb_get_intf(interface); sdev->udev = usb_get_dev(udev); diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index e7458e1..715e8a7 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -485,7 +485,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, kzalloc(pdu->u.cmd_submit.transfer_buffer_length, GFP_KERNEL); if (!priv->urb->transfer_buffer) { - dev_err(&sdev->interface->dev, "malloc x_buff\n"); usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC); return; } diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c index 513961f..cd5326a 100644 --- a/drivers/staging/usbip/stub_tx.c +++ b/drivers/staging/usbip/stub_tx.c @@ -42,7 +42,6 @@ void stub_enqueue_ret_unlink(struct stub_device *sdev, __u32 seqnum, unlink = kzalloc(sizeof(struct stub_unlink), GFP_ATOMIC); if (!unlink) { - dev_err(&sdev->interface->dev, "alloc stub_unlink\n"); usbip_event_add(&sdev->ud, VDEV_EVENT_ERROR_MALLOC); return; } diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 216648d..f1ca084 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -434,16 +434,13 @@ static void vhci_tx_urb(struct urb *urb) } priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC); - - spin_lock(&vdev->priv_lock); - if (!priv) { - dev_err(&urb->dev->dev, "malloc vhci_priv\n"); - spin_unlock(&vdev->priv_lock); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); return; } + spin_lock(&vdev->priv_lock); + priv->seqnum = atomic_inc_return(&the_controller->seqnum); if (priv->seqnum == 0xffff) dev_info(&urb->dev->dev, "seqnum max\n"); @@ -684,7 +681,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) /* setup CMD_UNLINK pdu */ unlink = kzalloc(sizeof(struct vhci_unlink), GFP_ATOMIC); if (!unlink) { - pr_err("malloc vhci_unlink\n"); spin_unlock(&vdev->priv_lock); spin_unlock(&the_controller->lock); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); |