Skip to contentSkip to conversation

scsi: fcoe: simplify if-if to if-else

PATCH Applied Yihao Han 2 participants 3 messages Apr 8, 2022 – Apr 26, 2022

Subsystems (2)
lore
Share & tools
lore

Yihao Han

author
#0 lore raw

PATCH 1/1 scsi: fcoe: simplify if-if to if-else

Replace if (!is_zero_ether_addr(mac)) with else for simplification and add curly brackets according to the kernel coding style:

"Do not unnecessarily use braces where a single statement will do."

...

"This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches"

Please refer to:
https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html

---
 drivers/scsi/fcoe/fcoe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/fcoe/fcoe.c +1 -1
index 44ca6110213c..983e00135fea 100644
@@ -2580,7 +2580,7 @@ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
 	/* pre-FIP */
 	if (is_zero_ether_addr(mac))
 		fcoe_ctlr_recv_flogi(fip, lport, fp);
-	if (!is_zero_ether_addr(mac))
+	else
 		fcoe_update_src_mac(lport, mac);
 done:
 	fc_lport_flogi_resp(seq, fp, lport);
Signature · 1 line
2.17.1
#1 lore raw

Yihao,

Quoted 2 lines

Replace if (!is_zero_ether_addr(mac)) with else for simplification and add curly brackets according to the kernel coding style:

Applied to 5.19/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Yihao Han
Quoted 8 lines · Yihao Han

Replace if (!is_zero_ether_addr(mac)) with else for simplification and add curly brackets according to the kernel coding style:

"Do not unnecessarily use braces where a single statement will do."

...

[...]

Applied to 5.19/scsi-queue, thanks!

[1/1] scsi: fcoe: simplify if-if to if-else

      https://git.kernel.org/mkp/scsi/c/65db22e505c4
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering