aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/ldusb.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa-dev@sang-engineering.com>2016-08-25 13:39:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 13:17:38 -0400
commit6714ffae751868e237d8f887eca1754d08ee814c (patch)
tree31178f3d661e26e648a353c206643972fc8e1a5a /drivers/usb/misc/ldusb.c
parent3cfb4842fbf4854b5b5a02a0e14a969d6a498aa0 (diff)
usb: misc: ldusb: don't print on ENOMEM
All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/ldusb.c')
-rw-r--r--drivers/usb/misc/ldusb.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 84890791c2f8..9ca595632f17 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -658,10 +658,8 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
658 /* allocate memory for our device state and initialize it */ 658 /* allocate memory for our device state and initialize it */
659 659
660 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 660 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
661 if (dev == NULL) { 661 if (!dev)
662 dev_err(&intf->dev, "Out of memory\n");
663 goto exit; 662 goto exit;
664 }
665 mutex_init(&dev->mutex); 663 mutex_init(&dev->mutex);
666 spin_lock_init(&dev->rbsl); 664 spin_lock_init(&dev->rbsl);
667 dev->intf = intf; 665 dev->intf = intf;
@@ -674,10 +672,8 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
674 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) && 672 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) &&
675 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { 673 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
676 buffer = kmalloc(256, GFP_KERNEL); 674 buffer = kmalloc(256, GFP_KERNEL);
677 if (buffer == NULL) { 675 if (!buffer)
678 dev_err(&intf->dev, "Couldn't allocate string buffer\n");
679 goto error; 676 goto error;
680 }
681 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ 677 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */
682 usb_string(udev, 255, buffer, 256); 678 usb_string(udev, 255, buffer, 256);
683 kfree(buffer); 679 kfree(buffer);
@@ -704,25 +700,19 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
704 700
705 dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint); 701 dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
706 dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL); 702 dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL);
707 if (!dev->ring_buffer) { 703 if (!dev->ring_buffer)
708 dev_err(&intf->dev, "Couldn't allocate ring_buffer\n");
709 goto error; 704 goto error;
710 }
711 dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); 705 dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
712 if (!dev->interrupt_in_buffer) { 706 if (!dev->interrupt_in_buffer)
713 dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
714 goto error; 707 goto error;
715 }
716 dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); 708 dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
717 if (!dev->interrupt_in_urb) 709 if (!dev->interrupt_in_urb)
718 goto error; 710 goto error;
719 dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? usb_endpoint_maxp(dev->interrupt_out_endpoint) : 711 dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? usb_endpoint_maxp(dev->interrupt_out_endpoint) :
720 udev->descriptor.bMaxPacketSize0; 712 udev->descriptor.bMaxPacketSize0;
721 dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL); 713 dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL);
722 if (!dev->interrupt_out_buffer) { 714 if (!dev->interrupt_out_buffer)
723 dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n");
724 goto error; 715 goto error;
725 }
726 dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); 716 dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
727 if (!dev->interrupt_out_urb) 717 if (!dev->interrupt_out_urb)
728 goto error; 718 goto error;