* [PATCH] scsi: qedf: Simplify mutex_unlock() usage
@ 2020-04-01 9:01 Daniel Wagner
2020-04-01 9:33 ` Daniel Wagner
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Wagner @ 2020-04-01 9:01 UTC (permalink / raw)
To: linux-scsi; +Cc: Daniel Wagner, Hannes Reinecke, Saurav Kashyap
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: qedf: Simplify mutex_unlock() usage
2020-04-01 9:01 [PATCH] scsi: qedf: Simplify mutex_unlock() usage Daniel Wagner
@ 2020-04-01 9:33 ` Daniel Wagner
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Wagner @ 2020-04-01 9:33 UTC (permalink / raw)
To: linux-scsi; +Cc: Hannes Reinecke, Saurav Kashyap
On Wed, Apr 01, 2020 at 11:01:20AM +0200, Daniel Wagner wrote:
> --- 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;
> }
> }
Looking at it again, I think we could even do
mutex_unlock(&lport->disc.disc_mutex);
if (rdata)
fc_rport_login(rdata);
fcport->rdata = rdata;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-01 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-01 9:01 [PATCH] scsi: qedf: Simplify mutex_unlock() usage Daniel Wagner
2020-04-01 9:33 ` Daniel Wagner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox