mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-02 03:03:00 +09:00
USB: serial: mos7720: fix error code in mos7720_write()
commitfea7372cbcupstream. This code should return -ENOMEM if the kmalloc() fails but instead it returns success. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes:0f64478cbc("USB: add USB serial mos7720 driver") 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:
@@ -1239,8 +1239,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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user