summaryrefslogtreecommitdiff
path: root/drivers/tty/n_hdlc.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2020-02-19 11:41:00 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-21 12:24:32 +0300
commitc549725ff85ab2dee1b8453a92ab437150ece800 (patch)
treed43431ad212a2c607f7da558ff05a21281a7a3a3 /drivers/tty/n_hdlc.c
parentcda3756ca5c4308c4cb1110209f27b49a680409a (diff)
downloadlinux-c549725ff85ab2dee1b8453a92ab437150ece800.tar.xz
n_hdlc: use clamp() for maxframe
It is easier to read. And use MAX_HDLC_FRAME_SIZE instead of magic constant. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200219084118.26491-6-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_hdlc.c')
-rw-r--r--drivers/tty/n_hdlc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
index 87f22e57e4f6..a713a98fea2e 100644
--- a/drivers/tty/n_hdlc.c
+++ b/drivers/tty/n_hdlc.c
@@ -894,10 +894,7 @@ static int __init n_hdlc_init(void)
int status;
/* range check maxframe arg */
- if (maxframe < 4096)
- maxframe = 4096;
- else if (maxframe > 65535)
- maxframe = 65535;
+ maxframe = clamp(maxframe, 4096, MAX_HDLC_FRAME_SIZE);
status = tty_register_ldisc(N_HDLC, &n_hdlc_ldisc);
if (!status)