diff options
author | Jiri Slaby <jslaby@suse.cz> | 2020-08-18 11:57:01 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-18 14:45:21 +0300 |
commit | 6d507c75e0cd359e4cede48230fb7e7a45c9bb74 (patch) | |
tree | 29b7b8eea017b71501fb20f76ae8a8c6791f67a4 /drivers/tty/vt/vc_screen.c | |
parent | 36c39220129e4048b6810dc732b49b4f23f2dcee (diff) | |
download | linux-6d507c75e0cd359e4cede48230fb7e7a45c9bb74.tar.xz |
vs_screen: kill tmp_count from vcs_read
Both tmp_count computations and the single use can be eliminated using
min(). Do so.
Side note: we need HEADER_SIZE to be unsigned for min() not to complain.
Fix that too as all its other uses do not mind.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200818085706.12163-11-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt/vc_screen.c')
-rw-r--r-- | drivers/tty/vt/vc_screen.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index c62c590ed816..8ebb6724a804 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -53,7 +53,7 @@ #undef attr #undef org #undef addr -#define HEADER_SIZE 4 +#define HEADER_SIZE 4u #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) @@ -361,8 +361,6 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) } } else { if (p < HEADER_SIZE) { - unsigned int tmp_count; - /* clamp header values if they don't fit */ con_buf0[0] = min(vc->vc_rows, 0xFFu); con_buf0[1] = min(vc->vc_cols, 0xFFu); @@ -375,12 +373,8 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) orig_count = this_round - p; } - tmp_count = HEADER_SIZE; - if (tmp_count > this_round) - tmp_count = this_round; - /* Advance state pointers and move on. */ - this_round -= tmp_count; + this_round -= min(HEADER_SIZE, this_round); p = HEADER_SIZE; con_buf0 = con_buf + HEADER_SIZE; /* If this_round >= 0, then p is even... */ |