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>
This commit is contained in:
parent
3cfb4842fb
commit
6714ffae75
|
@ -658,10 +658,8 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
|
||||||
/* allocate memory for our device state and initialize it */
|
/* allocate memory for our device state and initialize it */
|
||||||
|
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||||
if (dev == NULL) {
|
if (!dev)
|
||||||
dev_err(&intf->dev, "Out of memory\n");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
|
||||||
mutex_init(&dev->mutex);
|
mutex_init(&dev->mutex);
|
||||||
spin_lock_init(&dev->rbsl);
|
spin_lock_init(&dev->rbsl);
|
||||||
dev->intf = intf;
|
dev->intf = intf;
|
||||||
|
@ -674,10 +672,8 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
|
||||||
(le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) &&
|
(le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) &&
|
||||||
(le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
|
(le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
|
||||||
buffer = kmalloc(256, GFP_KERNEL);
|
buffer = kmalloc(256, GFP_KERNEL);
|
||||||
if (buffer == NULL) {
|
if (!buffer)
|
||||||
dev_err(&intf->dev, "Couldn't allocate string buffer\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
/* usb_string makes SETUP+STALL to leave always ControlReadLoop */
|
/* usb_string makes SETUP+STALL to leave always ControlReadLoop */
|
||||||
usb_string(udev, 255, buffer, 256);
|
usb_string(udev, 255, buffer, 256);
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
@ -704,25 +700,19 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
|
||||||
|
|
||||||
dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
|
dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
|
||||||
dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL);
|
dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL);
|
||||||
if (!dev->ring_buffer) {
|
if (!dev->ring_buffer)
|
||||||
dev_err(&intf->dev, "Couldn't allocate ring_buffer\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
|
dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
|
||||||
if (!dev->interrupt_in_buffer) {
|
if (!dev->interrupt_in_buffer)
|
||||||
dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!dev->interrupt_in_urb)
|
if (!dev->interrupt_in_urb)
|
||||||
goto error;
|
goto error;
|
||||||
dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? usb_endpoint_maxp(dev->interrupt_out_endpoint) :
|
dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? usb_endpoint_maxp(dev->interrupt_out_endpoint) :
|
||||||
udev->descriptor.bMaxPacketSize0;
|
udev->descriptor.bMaxPacketSize0;
|
||||||
dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL);
|
dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL);
|
||||||
if (!dev->interrupt_out_buffer) {
|
if (!dev->interrupt_out_buffer)
|
||||||
dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
|
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!dev->interrupt_out_urb)
|
if (!dev->interrupt_out_urb)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Reference in New Issue