From patchwork Tue Sep 25 08:57:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inderpal Singh X-Patchwork-Id: 11706 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8243823EFB for ; Tue, 25 Sep 2012 08:57:52 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 23D39A19039 for ; Tue, 25 Sep 2012 08:57:52 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so12262301iej.11 for ; Tue, 25 Sep 2012 01:57:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=XKMdgED4BmF3WaILvE4ndCaiehtYzru5T41bg93bqkM=; b=NrtwrPJiH+p6sqhMPtHKC9d7k73phZhmrz51oIw1ibPd16uHHgzpHoeXEYScUtn26F X7uzBXeeizkUYPh8PjYxWdTM2AlEUTgYAj9slkEd/vrzQz0S0MQxA+cFBv3+dw1StxzX gvk/RRf1hE/Fkym5amWBR6PeM7ELGZw0zXj7e27ajP9a7f/ox3MBp7/ZWvM74tTf/C9g mg8aWe6MZx8ngBOzXOq1jL9ttK+fn+jRwMeMBtlLBFP52Bk8DPTbBEETwCp700/lMGUD w7hGp/gRu28iFwu+WkfyF1yFx/JORNGmN35xJOMCFSmGH2kLE/Uc6RQPhDS6baXuNHT0 2DNA== Received: by 10.50.154.227 with SMTP id vr3mr7557654igb.43.1348563471852; Tue, 25 Sep 2012 01:57:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp283037igc; Tue, 25 Sep 2012 01:57:51 -0700 (PDT) Received: by 10.68.234.98 with SMTP id ud2mr43580588pbc.165.1348563471231; Tue, 25 Sep 2012 01:57:51 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id ou2si65151pbb.20.2012.09.25.01.57.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 01:57:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) smtp.mail=inderpal.singh@linaro.org Received: by mail-pb0-f50.google.com with SMTP id wz7so110925pbc.37 for ; Tue, 25 Sep 2012 01:57:51 -0700 (PDT) Received: by 10.68.138.198 with SMTP id qs6mr24348870pbb.151.1348563470874; Tue, 25 Sep 2012 01:57:50 -0700 (PDT) Received: from inder-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPS id rr6sm21523pbc.47.2012.09.25.01.57.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 01:57:50 -0700 (PDT) From: Inderpal Singh To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jassisinghbrar@gmail.com, boojin.kim@samsung.com, vinod.koul@intel.com, patches@linaro.org, kgene.kim@samsung.com Subject: [PATCH 1/3] DMA: PL330: Free memory allocated for peripheral channels Date: Tue, 25 Sep 2012 14:27:34 +0530 Message-Id: <1348563456-30569-2-git-send-email-inderpal.singh@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348563456-30569-1-git-send-email-inderpal.singh@linaro.org> References: <1348563456-30569-1-git-send-email-inderpal.singh@linaro.org> X-Gm-Message-State: ALoCoQmOgoZFc8EUDioh2VjTy52rSJKQqj6IyZr8/0LGMzS6jn0lgAMX7e7KdNpE+0KZAT/0POMU The allocated memory for peripheral channels is not being freed upon failure in probe and in module's remove funtion. It will lead to memory leakage. Hence free the allocated memory. Signed-off-by: Inderpal Singh --- drivers/dma/pl330.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 2ebd4cd..10c6b6a 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2962,7 +2962,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) ret = dma_async_device_register(pd); if (ret) { dev_err(&adev->dev, "unable to register DMAC\n"); - goto probe_err4; + goto probe_err5; } dev_info(&adev->dev, @@ -2975,6 +2975,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) return 0; +probe_err5: + kfree(pdmac->peripherals); probe_err4: pl330_del(pi); probe_err3: @@ -3025,6 +3027,7 @@ static int __devexit pl330_remove(struct amba_device *adev) res = &adev->res; release_mem_region(res->start, resource_size(res)); + kfree(pdmac->peripherals); kfree(pdmac); return 0;