USB: serial: mos7840: fix error code in mos7840_write()
Subsystems (3)
PATCH 1/1 USB: serial: mos7840: fix error code in mos7840_write()
This should return -ENOMEM instead of 0 if the kmalloc() fails.
Fixes 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/usb/serial/mos7840.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/mos7840.c +3 -1
@@ -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 );
Signature · 1 line
2.29.2
Quoted 4 lines · Dan Carpenter
This should return
-ENOMEMinstead of 0 if thekmalloc()fails.Fixes 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks.
Johan