Commit c549725f authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

n_hdlc: use clamp() for maxframe

It is easier to read. And use MAX_HDLC_FRAME_SIZE instead of magic
constant.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200219084118.26491-6-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cda3756c
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment