From patchwork Fri Oct 5 10:17:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inderpal Singh X-Patchwork-Id: 11999 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 B7E3F23EFB for ; Fri, 5 Oct 2012 10:18:04 +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 673BEA1903B for ; Fri, 5 Oct 2012 10:18:04 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3260369iej.11 for ; Fri, 05 Oct 2012 03:18:04 -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=azJ+o98Lw54e5I1+PuWFD7aMLaSOBcsTi+KyzRFUEgPE8lc3akd0+xRCHPReYEjHiT lXIVIqEhzSvTsIdSdlRKGcTvHalsH1LRErHWbG3GGBPuPLBzTyjRtDQlv1FS+KUcVyqL Ru8mqk4QFCN2M9Mo0c5+2dUIeZcZ8EDp7B20SaSHSIA2GZ8RCWVC6DGrDSEoil5TS0h9 h64Jf7iwQKiYNgvQpqST3+RRF0YtUR/e2oKscA5eI9riBUV4FK5/8EEzRFUo0afR+v0S rmbaKdJ7TEEMgOBWnKij15YQ0jHwldTwkajHY+kdUwsi304E7hT4ut/10KZa9BUTZqQr PovA== Received: by 10.50.150.198 with SMTP id uk6mr678430igb.43.1349432284170; Fri, 05 Oct 2012 03:18:04 -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 ex8csp117170igc; Fri, 5 Oct 2012 03:18:03 -0700 (PDT) Received: by 10.66.85.233 with SMTP id k9mr20177487paz.73.1349432283456; Fri, 05 Oct 2012 03:18:03 -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 j9si5649701paw.96.2012.10.05.03.18.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 03:18:03 -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 md4so1847924pbc.37 for ; Fri, 05 Oct 2012 03:18:03 -0700 (PDT) Received: by 10.66.77.227 with SMTP id v3mr20493227paw.6.1349432283204; Fri, 05 Oct 2012 03:18:03 -0700 (PDT) Received: from inder-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPS id qa4sm5848287pbb.70.2012.10.05.03.17.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 03:18:02 -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 v2 1/4] DMA: PL330: Free memory allocated for peripheral channels Date: Fri, 5 Oct 2012 15:47:53 +0530 Message-Id: <1349432276-22919-2-git-send-email-inderpal.singh@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349432276-22919-1-git-send-email-inderpal.singh@linaro.org> References: <1349432276-22919-1-git-send-email-inderpal.singh@linaro.org> X-Gm-Message-State: ALoCoQkK0FQDQWjaYJRF8JeBjC9E9s2WSB6rGebipdSbGsxfeNwXD7k2EtRwOHtuhdCLxNhu9SwK 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;