diff options
| author | Jiri Slaby (SUSE) <[email protected]> | 2023-08-16 10:55:26 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2023-08-22 12:58:15 +0000 |
| commit | 2ce2983c24c11beaeb6ef6da93bf7228679bd08b (patch) | |
| tree | 19ac746b96621130e6ba27afbafe17cbdc46fc2a /drivers/tty/tty_buffer.c | |
| parent | tty: tty_buffer: switch insert functions to size_t (diff) | |
| download | kernel-2ce2983c24c11beaeb6ef6da93bf7228679bd08b.tar.gz kernel-2ce2983c24c11beaeb6ef6da93bf7228679bd08b.zip | |
tty: tty_buffer: let tty_prepare_flip_string() return size_t
The same as in the previous patch, tty_prepare_flip_string() accepts
size_t as an size argument. It returns the same size (or less). It is
unexpected that it returns a signed value and can confuse users to check
for negative values.
Instead, return the same size_t as accepted to make clear we return
values >= 0, where zero in fact means failure.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/tty/tty_buffer.c')
| -rw-r--r-- | drivers/tty/tty_buffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 598891e53031..4f84466498f7 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -383,9 +383,9 @@ EXPORT_SYMBOL(__tty_insert_flip_char); * Returns: the length available and buffer pointer (@chars) to the space which * is now allocated and accounted for as ready for normal characters. */ -int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size) +size_t tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size) { - int space = __tty_buffer_request_room(port, size, false); + size_t space = __tty_buffer_request_room(port, size, false); if (likely(space)) { struct tty_buffer *tb = port->buf.tail; @@ -395,6 +395,7 @@ int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size) memset(flag_buf_ptr(tb, tb->used), TTY_NORMAL, space); tb->used += space; } + return space; } EXPORT_SYMBOL_GPL(tty_prepare_flip_string); |
