Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: linux-scsi@vger.kernel.org
Cc: Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.com>,
	Saurav Kashyap <skashyap@marvell.com>
Subject: [PATCH] scsi: qedf: Simplify mutex_unlock() usage
Date: Wed,  1 Apr 2020 11:01:20 +0200	[thread overview]
Message-ID: <20200401090120.24958-1-dwagner@suse.de> (raw)

The commit 6d1368e8f987 ("scsi: qedf: fixup locking in
qedf_restart_rport()") introduced the lock. Though the lock protects
only the fc_rport_create() call. Thus, we can move the mutex unlock up
before the if statement.

Cc: Hannes Reinecke <hare@suse.com>
Cc: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/qedf/qedf_els.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index 87e169dcebdb..c60eede92145 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -388,12 +388,11 @@ void qedf_restart_rport(struct qedf_rport *fcport)
 		mutex_lock(&lport->disc.disc_mutex);
 		/* Recreate the rport and log back in */
 		rdata = fc_rport_create(lport, port_id);
+		mutex_unlock(&lport->disc.disc_mutex);
 		if (rdata) {
-			mutex_unlock(&lport->disc.disc_mutex);
 			fc_rport_login(rdata);
 			fcport->rdata = rdata;
 		} else {
-			mutex_unlock(&lport->disc.disc_mutex);
 			fcport->rdata = NULL;
 		}
 	}
-- 
2.26.0


             reply	other threads:[~2020-04-01  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  9:01 Daniel Wagner [this message]
2020-04-01  9:33 ` [PATCH] scsi: qedf: Simplify mutex_unlock() usage Daniel Wagner

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=20200401090120.24958-1-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=hare@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=skashyap@marvell.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