Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35154242rwd; Mon, 10 Jul 2023 03:28:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlGzIEwt6f2u+gqSk0UUkL1rSMFJn29DHrRxMS0njcTny34uG86qsGWW91HUPiE85yn0wfy5 X-Received: by 2002:a92:c688:0:b0:345:af82:dc3a with SMTP id o8-20020a92c688000000b00345af82dc3amr13301133ilg.14.1688984923434; Mon, 10 Jul 2023 03:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688984923; cv=none; d=google.com; s=arc-20160816; b=uuVVKhcws847sjPiOk2b67bazTUWKIip56T4VJAkYb4rK16A9JUYQXURHMDyLMfKPT YPX1AKxDQlUSPo0LcG8Q0e+Pv4m7/oiIF2XIvfB2gaFRM1GchYmZKr2LpRr7xWI+s/3o ogKOEZle71lZkahl/Om2z9iXeJyx41SdHn8HIka12eJvneg7yqOBoQOzboMd7oQ/off4 7BcS2e1vsKZn1FlzRpUYWA1OzoLgW1RzWrhX7Mv2l4iI52kfMjDnjzCJczzek5skaQAl A9c8TC3RYaZ+Be0yzpEqjes/4qMcky8DNofeOxHEkD07k1QkGmKXetSA6Uw+Ul56GHNt ZUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=tNUECiVMp7ZS1ixbMQ6ZLpptFzFK62iC3KhilSMP8z0=; fh=OgZrEhlWvvghRXXO5YWqL4tdeqx/7l39QdC5tdTMdVg=; b=dT+Oe9faaGWPVtbTC72dgYsHe8yVn9G90NjI0iWVGpBtNX0/YPpTjSa8lNKwps7JMb xBmjlsAgXC7u/pBR05ebjiXA5EeA7Aa3NQdf5ATEgIw4lqcpM40eMzHZzeH5qf8iK5OA tGXVfhaSjHj363Qm9i+HclIaXckerKQeUfylpUJ1ksdZC7mAWktnZD70VssL8nBF+EFm Z16xqGyHNjuSN/RySt7gysIK4B6F+S8B3Zl1Swpx7p9+CoTlJAfc8ZWs38hxhDFp4GPK Pc3bcIukpYjcwYI8HHOHgNeF1lkCAl8bZx+G8K+HmzeGESOhTPeTBHYCtoAxKeoR1/l7 hCbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id co14-20020a17090afe8e00b00263e8027e64si6928169pjb.138.2023.07.10.03.28.31; Mon, 10 Jul 2023 03:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233062AbjGJKHQ (ORCPT + 99 others); Mon, 10 Jul 2023 06:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbjGJKG4 (ORCPT ); Mon, 10 Jul 2023 06:06:56 -0400 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B3F4215; Mon, 10 Jul 2023 03:03:46 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Vn109gM_1688983371; Received: from 30.97.48.56(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vn109gM_1688983371) by smtp.aliyun-inc.com; Mon, 10 Jul 2023 18:02:53 +0800 Message-ID: <6f5ca23d-4f23-4030-2196-35026e936145@linux.alibaba.com> Date: Mon, 10 Jul 2023 18:03:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 2/2] serial: sprd: Fix DMA buffer leak issue To: Chunyan Zhang , Greg Kroah-Hartman , Jiri Slaby Cc: linux-serial@vger.kernel.org, Orson Zhai , Chunyan Zhang , LKML References: <20230710080348.4137875-1-chunyan.zhang@unisoc.com> <20230710080348.4137875-2-chunyan.zhang@unisoc.com> From: Baolin Wang In-Reply-To: <20230710080348.4137875-2-chunyan.zhang@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 LGTM. Reviewed-by: Baolin Wang > --- > 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; > } >