linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/38] arm: mach-s3c64: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 07/38] arm: locomo: " Levente Kurusa
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-s3c64xx/dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 7e22c21..090852d 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -663,6 +663,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
 	err = device_register(&dmac->dev);
 	if (err) {
 		printk(KERN_ERR "%s: failed to register device\n", __func__);
+		put_device(&dmac->dev);
 		goto err_alloc;
 	}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 07/38] arm: locomo: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
  2013-12-19 15:03 ` [PATCH 06/38] arm: mach-s3c64: add missing put_device call Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 08/38] arm: mach-rpc: " Levente Kurusa
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.

Also, rework error path to remove the out label by return -ENOMEM explicitly if
kzalloc fails.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/common/locomo.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index b55c362..e17d02c 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -224,10 +224,8 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
 	int ret;
 
 	dev = kzalloc(sizeof(struct locomo_dev), GFP_KERNEL);
-	if (!dev) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!dev)
+		return -ENOMEM;
 
 	/*
 	 * If the parent device has a DMA mask associated with it,
@@ -256,8 +254,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
 
 	ret = device_register(&dev->dev);
 	if (ret) {
- out:
-		kfree(dev);
+ 		put_device(&dev->dev);
 	}
 	return ret;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 08/38] arm: mach-rpc: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
  2013-12-19 15:03 ` [PATCH 06/38] arm: mach-s3c64: add missing put_device call Levente Kurusa
  2013-12-19 15:03 ` [PATCH 07/38] arm: locomo: " Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 09/38] arm: mach-imx: add missing put_device calls Levente Kurusa
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-rpc/ecard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index fcb1d59..1c5f7cb 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -961,8 +961,10 @@ static int __init ecard_probe(int slot, unsigned irq, card_type_t type)
 	slot_to_expcard[slot] = ec;
 
 	rc = device_register(&ec->dev);
-	if (rc)
+	if (rc) {
+		put_device(&ec->dev);
 		goto nodev;
+	}
 
 	return 0;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 09/38] arm: mach-imx: add missing put_device calls
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
                   ` (2 preceding siblings ...)
  2013-12-19 15:03 ` [PATCH 08/38] arm: mach-rpc: " Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 10/38] arm: exynos: add missing put_device call Levente Kurusa
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-imx/devices/devices.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
index 1b4366a..0b17c89 100644
--- a/arch/arm/mach-imx/devices/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -37,11 +37,14 @@ int __init mxc_device_init(void)
 	int ret;
 
 	ret = device_register(&mxc_aips_bus);
-	if (ret < 0)
+	if (ret < 0) {
+		put_device(&mxc_aips_bus);
 		goto done;
+	}
 
 	ret = device_register(&mxc_ahb_bus);
-
+	if(ret < 0)
+		put_device(&mxc_ahb_bus);
 done:
 	return ret;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 10/38] arm: exynos: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
                   ` (3 preceding siblings ...)
  2013-12-19 15:03 ` [PATCH 09/38] arm: mach-imx: add missing put_device calls Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 11/38] arm: mach-integrator: " Levente Kurusa
  2013-12-19 15:03 ` [PATCH 12/38] arm: s5pv210: " Levente Kurusa
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-exynos/common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 61d2906..8b58829 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -407,7 +407,13 @@ early_initcall(exynos4_l2x0_cache_init);
 
 static int __init exynos_init(void)
 {
+	int rc = 0;
+
 	printk(KERN_INFO "EXYNOS: Initializing architecture\n");
 
-	return device_register(&exynos4_dev);
+	rc = device_register(&exynos4_dev);
+	if (rc)
+		put_device(&exynos4_dev);
+	
+	return rc;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 11/38] arm: mach-integrator: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
                   ` (4 preceding siblings ...)
  2013-12-19 15:03 ` [PATCH 10/38] arm: exynos: add missing put_device call Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  2013-12-19 15:03 ` [PATCH 12/38] arm: s5pv210: " Levente Kurusa
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that we give up the last reference to the device.
Calling put_device on the failed device will allow lm_device_release to be
called which will kfree() the struct lm_device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-integrator/lm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c
index f52c7af..1199f38 100644
--- a/arch/arm/mach-integrator/lm.c
+++ b/arch/arm/mach-integrator/lm.c
@@ -89,8 +89,10 @@ int lm_device_register(struct lm_device *dev)
 	ret = request_resource(&iomem_resource, &dev->resource);
 	if (ret == 0) {
 		ret = device_register(&dev->dev);
-		if (ret)
+		if (ret) {
 			release_resource(&dev->resource);
+			put_device(&dev->dev);
+		}
 	}
 	return ret;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 12/38] arm: s5pv210: add missing put_device call
       [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
                   ` (5 preceding siblings ...)
  2013-12-19 15:03 ` [PATCH 11/38] arm: mach-integrator: " Levente Kurusa
@ 2013-12-19 15:03 ` Levente Kurusa
  6 siblings, 0 replies; 7+ messages in thread
From: Levente Kurusa @ 2013-12-19 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is required so that give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/arm/mach-s5pv210/common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..81f43ae 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -267,8 +267,14 @@ core_initcall(s5pv210_core_init);
 
 int __init s5pv210_init(void)
 {
+	int rc = 0;
+
 	printk(KERN_INFO "S5PV210: Initializing architecture\n");
-	return device_register(&s5pv210_dev);
+	rc = device_register(&s5pv210_dev);
+	if (rc)
+		put_device(&s5pv210_dev);
+
+	return rc;
 }
 
 /* uart registration process */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-12-19 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1387465429-3568-2-git-send-email-levex@linux.com>
2013-12-19 15:03 ` [PATCH 06/38] arm: mach-s3c64: add missing put_device call Levente Kurusa
2013-12-19 15:03 ` [PATCH 07/38] arm: locomo: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 08/38] arm: mach-rpc: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 09/38] arm: mach-imx: add missing put_device calls Levente Kurusa
2013-12-19 15:03 ` [PATCH 10/38] arm: exynos: add missing put_device call Levente Kurusa
2013-12-19 15:03 ` [PATCH 11/38] arm: mach-integrator: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 12/38] arm: s5pv210: " Levente Kurusa

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).