public inbox for kernel-janitors@vger.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-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] [SCSI] target: allow release() to be called on NULL
Date: Wed, 26 Jan 2011 08:58:25 +0000	[thread overview]
Message-ID: <20110126085825.GM2721@bicker> (raw)

This is a cleanup and not a bugfix.

container_of() does pointer math and the result of that math can
basically not be NULL here so "se_dev" is non-NULL.

Normally release() type functions accept a NULL parameter.  I don't
think target_core_dev_release() is ever called with a NULL parameter but
it's a cleaner to allow that.

So instead of checking "se_dev", I've changed it to check "item".

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 2764510..d9dcd9d 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1973,7 +1973,7 @@ static void target_core_dev_release(struct config_item *item)
 				struct se_subsystem_dev, se_dev_group);
 	struct config_group *dev_cg;
 
-	if (!(se_dev))
+	if (!item)
 		return;
 
 	dev_cg = &se_dev->se_dev_group;

             reply	other threads:[~2011-01-26  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26  8:58 Dan Carpenter [this message]
2011-01-26 22:53 ` [patch] [SCSI] target: allow release() to be called on NULL 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=20110126085825.GM2721@bicker \
    --to=error27@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox