Skip to content

Commit fea7372

Browse files
Dan Carpenterjhovold
authored andcommitted
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: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 0f64478 ("USB: add USB serial mos7720 driver") Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent 55317e2 commit fea7372

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/usb/serial/mos7720.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,10 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
10941094
if (urb->transfer_buffer == NULL) {
10951095
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
10961096
GFP_ATOMIC);
1097-
if (!urb->transfer_buffer)
1097+
if (!urb->transfer_buffer) {
1098+
bytes_sent = -ENOMEM;
10981099
goto exit;
1100+
}
10991101
}
11001102
transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
11011103

0 commit comments

Comments
 (0)