n_hdlc: simplify freeing of buffer list
authorJiri Slaby <jslaby@suse.cz>
Wed, 19 Feb 2020 08:41:01 +0000 (09:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2020 09:24:33 +0000 (10:24 +0100)
commit30fafd92c272d238efe781a5daeaa4af2824067a
tree54af8ed2a311b4883184a334015049e4971e3c27
parentc549725ff85ab2dee1b8453a92ab437150ece800
n_hdlc: simplify freeing of buffer list

n_hdlc_release contains four loops to free each buffer list. Create a
helper (n_hdlc_free_buf_list) and call it for every list instead. It
makes n_hdlc_release more readable.

We are switching from "for (;;)" to "do {} while (buf)" which avoids the
"if (buf)" completely -- kfree is a nop for NULL pointers.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200219084118.26491-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_hdlc.c