diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-01-28 12:35:23 +0300 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2021-01-28 10:57:22 +0100 |
commit | fea7372cbc40869876df0f045e367f6f97a1666c (patch) | |
tree | 0d9fa8d857e04f1a79b99ad1bdb7e2678ec569a9 /drivers/usb/serial/mos7720.c | |
parent | 55317e22391ffc5aa297c3a617c8c3302fb184b6 (diff) | |
download | linux-fea7372cbc40869876df0f045e367f6f97a1666c.tar.bz2 |
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: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
-rw-r--r-- | drivers/usb/serial/mos7720.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index ed347a6d50ba..aa55169796a3 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -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); |