public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ntb_transport: use put_device() instead of kfree()
@ 2018-03-09 10:33 Arvind Yadav
  2018-03-09 16:46 ` Logan Gunthorpe
  2018-05-22  0:48 ` Jon Mason
  0 siblings, 2 replies; 4+ messages in thread
From: Arvind Yadav @ 2018-03-09 10:33 UTC (permalink / raw)
  To: jdmason, dave.jiang, allenbh; +Cc: linux-kernel, linux-ntb

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/ntb/ntb_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 9878c48..8182a3a 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -393,7 +393,7 @@ int ntb_transport_register_client_dev(char *device_name)
 
 		rc = device_register(dev);
 		if (rc) {
-			kfree(client_dev);
+			put_device(dev);
 			goto err;
 		}
 
-- 
1.9.1

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

end of thread, other threads:[~2018-05-22 16:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 10:33 [PATCH] ntb_transport: use put_device() instead of kfree() Arvind Yadav
2018-03-09 16:46 ` Logan Gunthorpe
2018-05-22  0:48 ` Jon Mason
2018-05-22 16:56   ` Logan Gunthorpe

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