Commit fea7372c authored by Dan Carpenter's avatar Dan Carpenter Committed by Johan Hovold
Browse files

USB: serial: mos7720: fix error code in mos7720_write()



This code should return -ENOMEM if the kmalloc() fails but instead
it returns success.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: 0f64478c

 ("USB: add USB serial mos7720 driver")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 55317e22
......@@ -1094,8 +1094,10 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
GFP_ATOMIC);
if (!urb->transfer_buffer)
if (!urb->transfer_buffer) {
bytes_sent = -ENOMEM;
goto exit;
}
}
transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment