staging: fwserial: Fix error handling in fwserial_create
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 21 Dec 2020 12:24:35 +0000 (20:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Mar 2021 11:34:08 +0000 (12:34 +0100)
commitb3854d1550f09e7616d915d9a540a88e1d269c66
tree0f27c1c8d20e8fdf4dd43176219e77ab733b3d0a
parenta03583775a5f3e0171e15692159cdbf7816ddf6f
staging: fwserial: Fix error handling in fwserial_create

[ Upstream commit f31559af97a0eabd467e4719253675b7dccb8a46 ]

When fw_core_add_address_handler() fails, we need to destroy
the port by tty_port_destroy(). Also we need to unregister
the address handler by fw_core_remove_address_handler() on
failure.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20201221122437.10274-1-dinghao.liu@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/fwserial/fwserial.c