linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: emilgoode@gmail.com (Emil Goode)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: imx: don't allocate memory for .dma_mask of struct device
Date: Mon, 26 May 2014 18:41:23 +0200	[thread overview]
Message-ID: <1401122483-31603-3-git-send-email-emilgoode@gmail.com> (raw)
In-Reply-To: <1401122483-31603-1-git-send-email-emilgoode@gmail.com>

The first patch in this series changed the platform_device_alloc
function to assign the u64 .dma_mask pointer of struct device to
the address of a u64 .dma_mask member of struct platform_object.

This means that we no longer should allocate memory for the .dma_mask
pointer of struct device when using platform_device_alloc() and the
u64 .dma_mask of struct platform_object that it points to will be freed
when the release callback function platform_device_release is called.

Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
 arch/arm/mach-imx/devices/platform-ipu-core.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c
index 6bd7c3f..4499a7d 100644
--- a/arch/arm/mach-imx/devices/platform-ipu-core.c
+++ b/arch/arm/mach-imx/devices/platform-ipu-core.c
@@ -79,10 +79,6 @@ struct platform_device *__init imx_alloc_mx3_camera(
 	if (!pdev)
 		return ERR_PTR(-ENOMEM);
 
-	pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
-	if (!pdev->dev.dma_mask)
-		goto err;
-
 	*pdev->dev.dma_mask = DMA_BIT_MASK(32);
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
@@ -96,7 +92,6 @@ struct platform_device *__init imx_alloc_mx3_camera(
 		ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
 		if (ret) {
 err:
-			kfree(pdev->dev.dma_mask);
 			platform_device_put(pdev);
 			return ERR_PTR(-ENODEV);
 		}
-- 
1.7.10.4

  parent reply	other threads:[~2014-05-26 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 16:41 [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Emil Goode
2014-05-26 16:41 ` [PATCH 2/3] driver core/platform: make .name of struct platform_object a C99 flexible array Emil Goode
2014-05-26 16:41 ` Emil Goode [this message]
2014-05-26 16:51 ` [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Russell King - ARM Linux
2014-05-26 18:31   ` Emil Goode
2014-05-26 18:14 ` Uwe Kleine-König
2014-05-26 19:14 ` Yann Droneaud
2014-05-26 19:30 ` Dan Carpenter
2014-05-26 19:40   ` Emil Goode

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=1401122483-31603-3-git-send-email-emilgoode@gmail.com \
    --to=emilgoode@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).