diff mbox

[17/38] parisc: kernel: add missing put_device call

Message ID 1387465429-3568-18-git-send-email-levex@linux.com (mailing list archive)
State Rejected
Headers show

Commit Message

Levente Kurusa Dec. 19, 2013, 3:03 p.m. UTC
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/parisc/kernel/drivers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Bottomley Dec. 19, 2013, 3:29 p.m. UTC | #1
On Thu, 2013-12-19 at 16:03 +0100, Levente Kurusa wrote:
> This is required so that we give up the last reference to the device.

No, it's not.  And the subject is misleading at best, since this isn't
any form of problem in the code.

If the add fails, the device isn't visible in sysfs and no references
have been handed out.  We're perfectly entitled to follow the common
pattern of simply destroying it at this point rather than going through
the nascent refcounting.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" 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/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index 14285ca..b97cc05 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -428,7 +428,7 @@  struct parisc_device * create_tree_node(char id, struct device *parent)
 	dev->dev.dma_mask = &dev->dma_mask;
 	dev->dev.coherent_dma_mask = dev->dma_mask;
 	if (device_register(&dev->dev)) {
-		kfree(dev);
+		put_device(&dev->dev);
 		return NULL;
 	}