public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipack: add missing put_device() after device_register() failed
@ 2013-02-26  9:03 Samuel Iglesias Gonsalvez
  2013-02-26 22:28 ` Dmitry Torokhov
  0 siblings, 1 reply; 11+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2013-02-26  9:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jens Taprogge, industrypack-devel, linux-kernel,
	Samuel Iglesias Gonsalvez

put_device() must be called after device_register() fails,
since device_register() always initializes the refcount
on the device structure to one.

dev->id is free'd inside of ipack_device_release function.
So, it's not needed to do it here.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/ipack/ipack.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index 7ec6b20..3588ccf 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -449,7 +449,7 @@ int ipack_device_register(struct ipack_device *dev)
 
 	ret = device_register(&dev->dev);
 	if (ret < 0)
-		kfree(dev->id);
+		put_device(&dev->dev);
 
 	return ret;
 }
-- 
1.7.10.4


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

end of thread, other threads:[~2013-03-11  7:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26  9:03 [PATCH] ipack: add missing put_device() after device_register() failed Samuel Iglesias Gonsalvez
2013-02-26 22:28 ` Dmitry Torokhov
2013-02-27  9:00   ` Samuel Iglesias Gonsálvez
2013-03-08  8:21     ` [PATCH 1/3] ipack: avoid double free on device->id Samuel Iglesias Gonsalvez
2013-03-08  8:21       ` [PATCH 2/3] ipack: add ipack_get_device() ipack_put_device() Samuel Iglesias Gonsalvez
2013-03-08  8:21       ` [PATCH 3/3] ipack: split ipack_device_register() in several functions Samuel Iglesias Gonsalvez
2013-03-08 17:47       ` [PATCH 1/3] ipack: avoid double free on device->id Greg Kroah-Hartman
2013-03-08 18:11         ` Samuel Iglesias Gonsálvez
2013-03-08 19:36           ` Greg Kroah-Hartman
2013-03-11  7:58             ` Samuel Iglesias Gonsálvez
2013-03-08 18:11         ` Samuel Iglesias Gonsálvez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox