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>
This commit is contained in:
Jiri Slaby 2020-02-19 09:41:00 +01:00 committed by Greg Kroah-Hartman
parent cda3756ca5
commit c549725ff8
1 changed files with 1 additions and 4 deletions

View File

@ -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)