diff options
author | Wolfram Sang <wsa-dev@sang-engineering.com> | 2016-08-25 13:39:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-30 13:17:38 -0400 |
commit | 3cfb4842fbf4854b5b5a02a0e14a969d6a498aa0 (patch) | |
tree | 4a0f3aeb2856050f9a6b772073b9b24b85d6b3e1 /drivers/usb | |
parent | 081e303e49d417961f2e55a87badd10959935eac (diff) |
usb: misc: iowarrior: 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')
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 7defa34dd4fa..095778ff984d 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -278,7 +278,7 @@ static ssize_t iowarrior_read(struct file *file, char __user *buffer, | |||
278 | dev = file->private_data; | 278 | dev = file->private_data; |
279 | 279 | ||
280 | /* verify that the device wasn't unplugged */ | 280 | /* verify that the device wasn't unplugged */ |
281 | if (dev == NULL || !dev->present) | 281 | if (!dev || !dev->present) |
282 | return -ENODEV; | 282 | return -ENODEV; |
283 | 283 | ||
284 | dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", | 284 | dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", |
@@ -480,9 +480,8 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, | |||
480 | int io_res; /* checks for bytes read/written and copy_to/from_user results */ | 480 | int io_res; /* checks for bytes read/written and copy_to/from_user results */ |
481 | 481 | ||
482 | dev = file->private_data; | 482 | dev = file->private_data; |
483 | if (dev == NULL) { | 483 | if (!dev) |
484 | return -ENODEV; | 484 | return -ENODEV; |
485 | } | ||
486 | 485 | ||
487 | buffer = kzalloc(dev->report_size, GFP_KERNEL); | 486 | buffer = kzalloc(dev->report_size, GFP_KERNEL); |
488 | if (!buffer) | 487 | if (!buffer) |
@@ -652,9 +651,8 @@ static int iowarrior_release(struct inode *inode, struct file *file) | |||
652 | int retval = 0; | 651 | int retval = 0; |
653 | 652 | ||
654 | dev = file->private_data; | 653 | dev = file->private_data; |
655 | if (dev == NULL) { | 654 | if (!dev) |
656 | return -ENODEV; | 655 | return -ENODEV; |
657 | } | ||
658 | 656 | ||
659 | dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); | 657 | dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); |
660 | 658 | ||
@@ -764,10 +762,8 @@ static int iowarrior_probe(struct usb_interface *interface, | |||
764 | 762 | ||
765 | /* allocate memory for our device state and initialize it */ | 763 | /* allocate memory for our device state and initialize it */ |
766 | dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); | 764 | dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); |
767 | if (dev == NULL) { | 765 | if (!dev) |
768 | dev_err(&interface->dev, "Out of memory\n"); | ||
769 | return retval; | 766 | return retval; |
770 | } | ||
771 | 767 | ||
772 | mutex_init(&dev->mutex); | 768 | mutex_init(&dev->mutex); |
773 | 769 | ||
@@ -813,10 +809,8 @@ static int iowarrior_probe(struct usb_interface *interface, | |||
813 | if (!dev->int_in_urb) | 809 | if (!dev->int_in_urb) |
814 | goto error; | 810 | goto error; |
815 | dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL); | 811 | dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL); |
816 | if (!dev->int_in_buffer) { | 812 | if (!dev->int_in_buffer) |
817 | dev_err(&interface->dev, "Couldn't allocate int_in_buffer\n"); | ||
818 | goto error; | 813 | goto error; |
819 | } | ||
820 | usb_fill_int_urb(dev->int_in_urb, dev->udev, | 814 | usb_fill_int_urb(dev->int_in_urb, dev->udev, |
821 | usb_rcvintpipe(dev->udev, | 815 | usb_rcvintpipe(dev->udev, |
822 | dev->int_in_endpoint->bEndpointAddress), | 816 | dev->int_in_endpoint->bEndpointAddress), |
@@ -827,10 +821,8 @@ static int iowarrior_probe(struct usb_interface *interface, | |||
827 | dev->read_queue = | 821 | dev->read_queue = |
828 | kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER), | 822 | kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER), |
829 | GFP_KERNEL); | 823 | GFP_KERNEL); |
830 | if (!dev->read_queue) { | 824 | if (!dev->read_queue) |
831 | dev_err(&interface->dev, "Couldn't allocate read_queue\n"); | ||
832 | goto error; | 825 | goto error; |
833 | } | ||
834 | /* Get the serial-number of the chip */ | 826 | /* Get the serial-number of the chip */ |
835 | memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial)); | 827 | memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial)); |
836 | usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial, | 828 | usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial, |