Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbbEUF2X (ORCPT ); Thu, 21 May 2015 01:28:23 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:37190 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbbEUF2U (ORCPT ); Thu, 21 May 2015 01:28:20 -0400 MIME-Version: 1.0 In-Reply-To: <1432120864-23916-1-git-send-email-jonathanh@nvidia.com> References: <1432120864-23916-1-git-send-email-jonathanh@nvidia.com> From: Alexandre Courbot Date: Thu, 21 May 2015 14:27:59 +0900 Message-ID: Subject: Re: [PATCH] serial: tegra: Fix memory leak on DMA setup failure To: Jon Hunter Cc: Alexandre Courbot , Laxman Dewangan , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, "linux-tegra@vger.kernel.org" , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1074 Lines: 24 On Wed, May 20, 2015 at 8:21 PM, Jon Hunter wrote: > If the call to dmaengine_slave_config() fails, then the DMA buffer will > not be freed/unmapped. Fix this by moving the code that stores the > address of the buffer in the tegra_uart_port structure to before the > call to dmaengine_slave_config(). > > Reported-by: Alexandre Courbot > Signed-off-by: Jon Hunter Looks good, we had the same if/else condition appearing three times in this function for no real reason anyway. This considerably simplifies the code. > drivers/tty/serial/serial-tegra.c | 32 +++++++++++--------------------- > 1 file changed, 11 insertions(+), 21 deletions(-) Negative number of lines, another good point for this patch! Reviewed-by: Alexandre Courbot -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/