The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly Signed-off-by: Himadri Pandya <himadrispandya@xxxxxxxxx> --- drivers/usb/serial/io_ti.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c327d4cf7928..ab2370b80b3c 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -260,16 +260,12 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, { int status; - status = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN), - value, index, data, size, 1000); - if (status < 0) + status = usb_control_msg_recv(dev, 0, request, USB_TYPE_VENDOR | + USB_RECIP_DEVICE | USB_DIR_IN, value, + index, data, size, 1000, GFP_KERNEL); + if (status) return status; - if (status != size) { - dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", - __func__, size, status); - return -ECOMM; - } + return 0; } @@ -278,16 +274,12 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, { int status; - status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT), - value, index, data, size, timeout); - if (status < 0) + status = usb_control_msg_send(dev, 0, request, USB_TYPE_VENDOR | + USB_RECIP_DEVICE | USB_DIR_OUT, value, + index, data, size, timeout, GFP_KERNEL); + if (status) return status; - if (status != size) { - dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", - __func__, size, status); - return -ECOMM; - } + return 0; } -- 2.17.1