mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
USB: serial: mos7840: fix error code in mos7840_write()
commita70aa7dc60upstream. This should return -ENOMEM instead of 0 if the kmalloc() fails. Fixes:3f5429746d("USB: Moschip 7840 USB-Serial Driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
11fd58946e
commit
bcac85caba
@@ -883,8 +883,10 @@ static int mos7840_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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user