提交 3cfb4842 编写于 作者: W Wolfram Sang 提交者: Greg Kroah-Hartman

usb: misc: iowarrior: don't print on ENOMEM

All kmalloc-based functions print enough information on failures.
Signed-off-by: NWolfram Sang <wsa-dev@sang-engineering.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 081e303e
...@@ -278,7 +278,7 @@ static ssize_t iowarrior_read(struct file *file, char __user *buffer, ...@@ -278,7 +278,7 @@ static ssize_t iowarrior_read(struct file *file, char __user *buffer,
dev = file->private_data; dev = file->private_data;
/* verify that the device wasn't unplugged */ /* verify that the device wasn't unplugged */
if (dev == NULL || !dev->present) if (!dev || !dev->present)
return -ENODEV; return -ENODEV;
dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", 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,9 +480,8 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
int io_res; /* checks for bytes read/written and copy_to/from_user results */ int io_res; /* checks for bytes read/written and copy_to/from_user results */
dev = file->private_data; dev = file->private_data;
if (dev == NULL) { if (!dev)
return -ENODEV; return -ENODEV;
}
buffer = kzalloc(dev->report_size, GFP_KERNEL); buffer = kzalloc(dev->report_size, GFP_KERNEL);
if (!buffer) if (!buffer)
...@@ -652,9 +651,8 @@ static int iowarrior_release(struct inode *inode, struct file *file) ...@@ -652,9 +651,8 @@ static int iowarrior_release(struct inode *inode, struct file *file)
int retval = 0; int retval = 0;
dev = file->private_data; dev = file->private_data;
if (dev == NULL) { if (!dev)
return -ENODEV; return -ENODEV;
}
dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor);
...@@ -764,10 +762,8 @@ static int iowarrior_probe(struct usb_interface *interface, ...@@ -764,10 +762,8 @@ static int iowarrior_probe(struct usb_interface *interface,
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
if (dev == NULL) { if (!dev)
dev_err(&interface->dev, "Out of memory\n");
return retval; return retval;
}
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
...@@ -813,10 +809,8 @@ static int iowarrior_probe(struct usb_interface *interface, ...@@ -813,10 +809,8 @@ static int iowarrior_probe(struct usb_interface *interface,
if (!dev->int_in_urb) if (!dev->int_in_urb)
goto error; goto error;
dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL); dev->int_in_buffer = kmalloc(dev->report_size, GFP_KERNEL);
if (!dev->int_in_buffer) { if (!dev->int_in_buffer)
dev_err(&interface->dev, "Couldn't allocate int_in_buffer\n");
goto error; goto error;
}
usb_fill_int_urb(dev->int_in_urb, dev->udev, usb_fill_int_urb(dev->int_in_urb, dev->udev,
usb_rcvintpipe(dev->udev, usb_rcvintpipe(dev->udev,
dev->int_in_endpoint->bEndpointAddress), dev->int_in_endpoint->bEndpointAddress),
...@@ -827,10 +821,8 @@ static int iowarrior_probe(struct usb_interface *interface, ...@@ -827,10 +821,8 @@ static int iowarrior_probe(struct usb_interface *interface,
dev->read_queue = dev->read_queue =
kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER), kmalloc(((dev->report_size + 1) * MAX_INTERRUPT_BUFFER),
GFP_KERNEL); GFP_KERNEL);
if (!dev->read_queue) { if (!dev->read_queue)
dev_err(&interface->dev, "Couldn't allocate read_queue\n");
goto error; goto error;
}
/* Get the serial-number of the chip */ /* Get the serial-number of the chip */
memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial)); memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial));
usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial, usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册