alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slimbus: core: use put_device() instead of kfree()
@ 2018-03-07 10:22 Arvind Yadav
  2018-03-07 10:45 ` Srinivas Kandagatla
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2018-03-07 10:22 UTC (permalink / raw)
  To: srinivas.kandagatla, broonie, gregkh; +Cc: alsa-devel, linux-kernel

Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/slimbus/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 4988a8f..7ddfc67 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -141,7 +141,7 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
 	sbdev->e_addr = *eaddr;
 	ret = slim_add_device(ctrl, sbdev, node);
 	if (ret) {
-		kfree(sbdev);
+		put_device(&sbdev->dev);
 		return NULL;
 	}
 
-- 
1.9.1

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

end of thread, other threads:[~2018-03-07 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07 10:22 [PATCH] slimbus: core: use put_device() instead of kfree() Arvind Yadav
2018-03-07 10:45 ` Srinivas Kandagatla

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