diff mbox

amba: Put the device's of_node on its release

Message ID 1400173652-30583-1-git-send-email-pawel.moll@arm.com
State New
Headers show

Commit Message

Pawel Moll May 15, 2014, 5:07 p.m. UTC
An amba device created from Device Tree, when released, does not
decrease of_node's reference counter.

Fixed by adding a call to of_device_node_put() on the release
path, in a similar way to what platform_device_release() is doing.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/amba/bus.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rob Herring May 15, 2014, 6:57 p.m. UTC | #1
On Thu, May 15, 2014 at 12:07 PM, Pawel Moll <pawel.moll@arm.com> wrote:
> An amba device created from Device Tree, when released, does not
> decrease of_node's reference counter.
>
> Fixed by adding a call to of_device_node_put() on the release
> path, in a similar way to what platform_device_release() is doing.
>
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>

Acked-by: Rob Herring <robh@kernel.org>

Does this go with the rest of your series? Who needs to pick this up?

Rob

> ---
>  drivers/amba/bus.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 3cf61a1..0f489fb 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -17,6 +17,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/amba/bus.h>
>  #include <linux/sizes.h>
> +#include <linux/of_device.h>
>
>  #include <asm/irq.h>
>
> @@ -268,6 +269,7 @@ static void amba_device_release(struct device *dev)
>  {
>         struct amba_device *d = to_amba_device(dev);
>
> +       of_device_node_put(dev);
>         if (d->res.parent)
>                 release_resource(&d->res);
>         kfree(d);
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 3cf61a1..0f489fb 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -17,6 +17,7 @@ 
 #include <linux/pm_runtime.h>
 #include <linux/amba/bus.h>
 #include <linux/sizes.h>
+#include <linux/of_device.h>
 
 #include <asm/irq.h>
 
@@ -268,6 +269,7 @@  static void amba_device_release(struct device *dev)
 {
 	struct amba_device *d = to_amba_device(dev);
 
+	of_device_node_put(dev);
 	if (d->res.parent)
 		release_resource(&d->res);
 	kfree(d);