From: Dinghao Liu <dinghao.liu@zju.edu.cn> To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Abheek Dhawan <adawesomeguy222@gmail.com>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: fwserial: Fix error handling in fwserial_create Date: Mon, 21 Dec 2020 20:24:35 +0800 [thread overview] Message-ID: <20201221122437.10274-1-dinghao.liu@zju.edu.cn> (raw) 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> --- drivers/staging/fwserial/fwserial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index db83d34cd677..c368082aae1a 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -2189,6 +2189,7 @@ static int fwserial_create(struct fw_unit *unit) err = fw_core_add_address_handler(&port->rx_handler, &fw_high_memory_region); if (err) { + tty_port_destroy(&port->port); kfree(port); goto free_ports; } @@ -2271,6 +2272,7 @@ static int fwserial_create(struct fw_unit *unit) free_ports: for (--i; i >= 0; --i) { + fw_core_remove_address_handler(&serial->ports[i]->rx_handler); tty_port_destroy(&serial->ports[i]->port); kfree(serial->ports[i]); } -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Dinghao Liu <dinghao.liu@zju.edu.cn> To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: devel@driverdev.osuosl.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Abheek Dhawan <adawesomeguy222@gmail.com> Subject: [PATCH] staging: fwserial: Fix error handling in fwserial_create Date: Mon, 21 Dec 2020 20:24:35 +0800 [thread overview] Message-ID: <20201221122437.10274-1-dinghao.liu@zju.edu.cn> (raw) 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> --- drivers/staging/fwserial/fwserial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index db83d34cd677..c368082aae1a 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -2189,6 +2189,7 @@ static int fwserial_create(struct fw_unit *unit) err = fw_core_add_address_handler(&port->rx_handler, &fw_high_memory_region); if (err) { + tty_port_destroy(&port->port); kfree(port); goto free_ports; } @@ -2271,6 +2272,7 @@ static int fwserial_create(struct fw_unit *unit) free_ports: for (--i; i >= 0; --i) { + fw_core_remove_address_handler(&serial->ports[i]->rx_handler); tty_port_destroy(&serial->ports[i]->port); kfree(serial->ports[i]); } -- 2.17.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next reply other threads:[~2020-12-21 12:25 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-21 12:24 Dinghao Liu [this message] 2020-12-21 12:24 ` [PATCH] staging: fwserial: Fix error handling in fwserial_create Dinghao Liu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201221122437.10274-1-dinghao.liu@zju.edu.cn \ --to=dinghao.liu@zju.edu.cn \ --cc=adawesomeguy222@gmail.com \ --cc=devel@driverdev.osuosl.org \ --cc=gregkh@linuxfoundation.org \ --cc=kjlu@umn.edu \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.