tty: make everyone's chars_in_buffer return >= 0
The tty line disciplines don't expect tty_operations::chars_in_buffer to return negative values. Fix the two drivers which violate this. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20210302062214.29627-43-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ab78b0c9fa
commit
10eb63e5a9
@ -3056,7 +3056,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty)
|
||||
{
|
||||
struct gsm_dlci *dlci = tty->driver_data;
|
||||
if (dlci->state == DLCI_CLOSED)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
return kfifo_len(&dlci->fifo);
|
||||
}
|
||||
|
||||
|
@ -896,7 +896,7 @@ static int vcc_chars_in_buffer(struct tty_struct *tty)
|
||||
port = vcc_get_ne(tty->index);
|
||||
if (unlikely(!port)) {
|
||||
pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
|
||||
return -ENODEV;
|
||||
return 0;
|
||||
}
|
||||
|
||||
num = port->chars_in_buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user