All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: James Bottomley <James.Bottomley@suse.de>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: [patch 1/2] [SCSI] target: remove an unused variable
Date: Mon, 03 Jan 2011 05:57:35 +0000	[thread overview]
Message-ID: <20110103055735.GU1886@bicker> (raw)

We never use "fabric_cg" and also we leak it on the success path.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 18d15ff..d7b977d 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -117,7 +117,6 @@ static struct config_group *target_core_register_fabric(
 	struct config_group *group,
 	const char *name)
 {
-	struct config_group *fabric_cg;
 	struct target_fabric_configfs *tf;
 	int ret;
 
@@ -131,9 +130,6 @@ static struct config_group *target_core_register_fabric(
 	if (transport_subsystem_check_init() < 0)
 		return ERR_PTR(-EINVAL);
 
-	fabric_cg = kzalloc(sizeof(struct config_group), GFP_KERNEL);
-	if (!(fabric_cg))
-		return ERR_PTR(-ENOMEM);
 	/*
 	 * Below are some hardcoded request_module() calls to automatically
 	 * local fabric modules when the following is called:
@@ -155,7 +151,6 @@ static struct config_group *target_core_register_fabric(
 		if (ret < 0) {
 			printk(KERN_ERR "request_module() failed for"
 				" iscsi_target_mod.ko: %d\n", ret);
-			kfree(fabric_cg);
 			return ERR_PTR(-EINVAL);
 		}
 	} else if (!(strncmp(name, "loopback", 8))) {
@@ -169,7 +164,6 @@ static struct config_group *target_core_register_fabric(
 		if (ret < 0) {
 			printk(KERN_ERR "request_module() failed for"
 				" tcm_loop.ko: %d\n", ret);
-			kfree(fabric_cg);
 			return ERR_PTR(-EINVAL);
 		}
 	}
@@ -178,7 +172,6 @@ static struct config_group *target_core_register_fabric(
 	if (!(tf)) {
 		printk(KERN_ERR "target_core_get_fabric() failed for %s\n",
 			name);
-		kfree(fabric_cg);
 		return ERR_PTR(-EINVAL);
 	}
 	printk(KERN_INFO "Target_Core_ConfigFS: REGISTER -> Located fabric:"

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: James Bottomley <James.Bottomley@suse.de>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: [patch 1/2] [SCSI] target: remove an unused variable
Date: Mon, 3 Jan 2011 08:57:35 +0300	[thread overview]
Message-ID: <20110103055735.GU1886@bicker> (raw)

We never use "fabric_cg" and also we leak it on the success path.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 18d15ff..d7b977d 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -117,7 +117,6 @@ static struct config_group *target_core_register_fabric(
 	struct config_group *group,
 	const char *name)
 {
-	struct config_group *fabric_cg;
 	struct target_fabric_configfs *tf;
 	int ret;
 
@@ -131,9 +130,6 @@ static struct config_group *target_core_register_fabric(
 	if (transport_subsystem_check_init() < 0)
 		return ERR_PTR(-EINVAL);
 
-	fabric_cg = kzalloc(sizeof(struct config_group), GFP_KERNEL);
-	if (!(fabric_cg))
-		return ERR_PTR(-ENOMEM);
 	/*
 	 * Below are some hardcoded request_module() calls to automatically
 	 * local fabric modules when the following is called:
@@ -155,7 +151,6 @@ static struct config_group *target_core_register_fabric(
 		if (ret < 0) {
 			printk(KERN_ERR "request_module() failed for"
 				" iscsi_target_mod.ko: %d\n", ret);
-			kfree(fabric_cg);
 			return ERR_PTR(-EINVAL);
 		}
 	} else if (!(strncmp(name, "loopback", 8))) {
@@ -169,7 +164,6 @@ static struct config_group *target_core_register_fabric(
 		if (ret < 0) {
 			printk(KERN_ERR "request_module() failed for"
 				" tcm_loop.ko: %d\n", ret);
-			kfree(fabric_cg);
 			return ERR_PTR(-EINVAL);
 		}
 	}
@@ -178,7 +172,6 @@ static struct config_group *target_core_register_fabric(
 	if (!(tf)) {
 		printk(KERN_ERR "target_core_get_fabric() failed for %s\n",
 			name);
-		kfree(fabric_cg);
 		return ERR_PTR(-EINVAL);
 	}
 	printk(KERN_INFO "Target_Core_ConfigFS: REGISTER -> Located fabric:"

             reply	other threads:[~2011-01-03  5:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-03  5:57 Dan Carpenter [this message]
2011-01-03  5:57 ` [patch 1/2] [SCSI] target: remove an unused variable Dan Carpenter
2011-01-04 23:37 ` Nicholas A. Bellinger
2011-01-04 23:37   ` Nicholas A. Bellinger

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=20110103055735.GU1886@bicker \
    --to=error27@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.