From: Masatake YAMATO <yamato@redhat.com>
To: open-iscsi@googlegroups.com
Cc: linux-kernel@vger.kernel.org, Masatake YAMATO <yamato@redhat.com>
Subject: [PATCH] libiscsi: avoid unnecessary multiple NULL assignments
Date: Sun, 12 Aug 2012 23:15:51 +0900 [thread overview]
Message-ID: <1344780951-5011-1-git-send-email-yamato@redhat.com> (raw)
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.
The second NULL assignment comes from commit:
3e5c28ad0391389959ccae81c938c7533efb3490
It seems that the line after kfifo_in invocation was introduced
accidentally.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
drivers/scsi/libiscsi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 82c3fd4..7aacf3a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -500,21 +500,20 @@ static void iscsi_free_task(struct iscsi_task *task)
task->sc = NULL;
/*
* login task is preallocated so do not free
*/
if (conn->login_task == task)
return;
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
if (sc) {
- task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
* queue command may call this to free the task, so
* it will decide how to return sc to scsi-ml.
*/
if (oldstate != ISCSI_TASK_REQUEUE_SCSIQ)
sc->scsi_done(sc);
}
}
--
1.7.11.2
reply other threads:[~2012-08-12 14:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1344780951-5011-1-git-send-email-yamato@redhat.com \
--to=yamato@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®