Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Chunyan Zhang <chunyan.zhang@unisoc.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial@vger.kernel.org, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] serial: sprd: Fix DMA buffer leak issue
Date: Mon, 10 Jul 2023 18:03:12 +0800	[thread overview]
Message-ID: <6f5ca23d-4f23-4030-2196-35026e936145@linux.alibaba.com> (raw)
In-Reply-To: <20230710080348.4137875-2-chunyan.zhang@unisoc.com>



On 7/10/2023 4:03 PM, Chunyan Zhang wrote:
> 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>

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.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;
>   }
>   

  reply	other threads:[~2023-07-10 10:07 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 ` [PATCH 2/2] serial: sprd: Fix DMA buffer leak issue Chunyan Zhang
2023-07-10 10:03   ` Baolin Wang [this message]
     [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=6f5ca23d-4f23-4030-2196-35026e936145@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=chunyan.zhang@unisoc.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