linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 22/42] drivers/scsi/lpfc: Adjust confusing if indentation
@ 2010-08-05 20:23 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2010-08-05 20:23 UTC (permalink / raw)
  To: James Smart, James E.J. Bottomley, linux-scsi, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>

In lpfc_init.c, the call to lpfc_destroy_vport_work_array only has an
effect if vports is not NULL, so move it into the if branch that it is
already aligned with.

In lpfc_vport.c, ndlp has already been tested, so it is only useful to test
it again in the if branch that it is already aligned with.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@

(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

if (p1[0].column == p2[0].column):
  cocci.print_main("branch",p1)
  cocci.print_secs("after",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/scsi/lpfc/lpfc_init.c  |    3 ++-
 drivers/scsi/lpfc/lpfc_vport.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 2786ee3..6f4bd5e 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2368,7 +2368,7 @@ lpfc_online(struct lpfc_hba *phba)
 	}
 
 	vports = lpfc_create_vport_work_array(phba);
-	if (vports != NULL)
+	if (vports != NULL) {
 		for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
 			struct Scsi_Host *shost;
 			shost = lpfc_shost_from_vport(vports[i]);
@@ -2381,6 +2381,7 @@ lpfc_online(struct lpfc_hba *phba)
 			spin_unlock_irq(shost->host_lock);
 		}
 		lpfc_destroy_vport_work_array(phba, vports);
+	}
 
 	lpfc_unblock_mgmt_io(phba);
 	return 0;
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 1655507..8420d19 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -690,11 +690,12 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
 			/* Indicate free memory when release */
 			NLP_SET_FREE_REQ(ndlp);
 		} else {
-			if (!NLP_CHK_NODE_ACT(ndlp))
+			if (!NLP_CHK_NODE_ACT(ndlp)) {
 				ndlp = lpfc_enable_node(vport, ndlp,
 						NLP_STE_UNUSED_NODE);
 				if (!ndlp)
 					goto skip_logo;
+			}
 
 			/* Remove ndlp from vport npld list */
 			lpfc_dequeue_node(vport, ndlp);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-05 20:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 20:23 [PATCH 22/42] drivers/scsi/lpfc: Adjust confusing if indentation Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).