public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Levente Kurusa <levex@linux.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Levente Kurusa <levex@linux.com>,
	Mike Christie <michaelc@cs.wisc.edu>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org
Subject: [PATCH 33/38] scsi: transport: add missing put_device call
Date: Thu, 19 Dec 2013 16:06:47 +0100	[thread overview]
Message-ID: <1387465612-3673-34-git-send-email-levex@linux.com> (raw)
In-Reply-To: <1387465612-3673-33-git-send-email-levex@linux.com>

This is required so that we give up the last reference to the device.
Remove the kfree() as well, because the put_device() will result in
iscsi_endpoint_release being called and hence it will be kfree'd.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 63a6ca4..ff20f35 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -219,8 +219,10 @@ iscsi_create_endpoint(int dd_size)
 	ep->dev.class = &iscsi_endpoint_class;
 	dev_set_name(&ep->dev, "ep-%llu", (unsigned long long) id);
 	err = device_register(&ep->dev);
-        if (err)
-                goto free_ep;
+        if (err) {
+        	put_device(&ep->dev);
+	        return NULL;
+	}
 
 	err = sysfs_create_group(&ep->dev.kobj, &iscsi_endpoint_group);
 	if (err)
@@ -233,10 +235,6 @@ iscsi_create_endpoint(int dd_size)
 unregister_dev:
 	device_unregister(&ep->dev);
 	return NULL;
-
-free_ep:
-	kfree(ep);
-	return NULL;
 }
 EXPORT_SYMBOL_GPL(iscsi_create_endpoint);
 
-- 
1.8.3.1


  reply	other threads:[~2013-12-19 15:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 15:06 [PATCH 32/38] pcie: add missing put_device call Levente Kurusa
2013-12-19 15:06 ` Levente Kurusa [this message]
2013-12-19 15:19   ` [PATCH 33/38] scsi: transport: " James Bottomley
2013-12-19 15:06 ` [PATCH 34/38] infiniband: core: " Levente Kurusa
2013-12-19 15:06 ` [PATCH 35/38] media: bt8xx: " Levente Kurusa
2013-12-19 15:06 ` [PATCH 36/38] dio: " Levente Kurusa
2013-12-19 15:06 ` [PATCH 37/38] uwb: umc-dev: " Levente Kurusa
2013-12-19 15:06 ` [PATCH 38/38] bcma: " Levente Kurusa
2013-12-19 22:10 ` [PATCH 32/38] pcie: " Bjorn Helgaas
2013-12-19 22:34   ` Greg Kroah-Hartman
2013-12-20  6:15   ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387465612-3673-34-git-send-email-levex@linux.com \
    --to=levex@linux.com \
    --cc=JBottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=open-iscsi@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox