From: Chunyan Zhang <chunyan.zhang@unisoc.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: <linux-serial@vger.kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Orson Zhai <orsonzhai@gmail.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Chunyan Zhang <chunyan.zhang@unisoc.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] serial: sprd: Fix DMA buffer leak issue
Date: Mon, 10 Jul 2023 16:03:48 +0800 [thread overview]
Message-ID: <20230710080348.4137875-2-chunyan.zhang@unisoc.com> (raw)
In-Reply-To: <20230710080348.4137875-1-chunyan.zhang@unisoc.com>
Release DMA buffer when _probe() returns fail to avoid memory leak.
Fixes: f4487db58eb7 ("serial: sprd: Add DMA mode support")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
drivers/tty/serial/sprd_serial.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 942808517393..e1f11382fc39 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -1203,7 +1203,7 @@ static int sprd_probe(struct platform_device *pdev)
ret = uart_register_driver(&sprd_uart_driver);
if (ret < 0) {
pr_err("Failed to register SPRD-UART driver\n");
- return ret;
+ goto free_rx_buf;
}
}
sprd_ports_num++;
@@ -1222,6 +1222,8 @@ static int sprd_probe(struct platform_device *pdev)
sprd_port[index] = NULL;
sprd_ports_num--;
uart_unregister_driver(&sprd_uart_driver);
+free_rx_buf:
+ sprd_rx_free_buf(sport);
return ret;
}
--
2.41.0
next prev parent reply other threads:[~2023-07-10 8:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 8:03 [PATCH 1/2] serial: sprd: Assign sprd_port after initialized to avoid wrong access Chunyan Zhang
2023-07-10 8:03 ` Chunyan Zhang [this message]
2023-07-10 10:03 ` [PATCH 2/2] serial: sprd: Fix DMA buffer leak issue Baolin Wang
[not found] ` <69d56da8-9530-e729-d527-89879d2bab06@web.de>
2023-07-10 13:30 ` Greg Kroah-Hartman
2023-07-11 2:58 ` Chunyan Zhang
2023-07-10 9:57 ` [PATCH 1/2] serial: sprd: Assign sprd_port after initialized to avoid wrong access Baolin Wang
2023-07-11 2:57 ` Chunyan Zhang
2023-07-12 1:39 ` Baolin Wang
2023-07-12 3:11 ` Chunyan Zhang
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=20230710080348.4137875-2-chunyan.zhang@unisoc.com \
--to=chunyan.zhang@unisoc.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=zhang.lyra@gmail.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox