Skip to contentSkip to conversation

bnx2:Make various functions to have a return type of void in the file bnx2.c

PATCH Sony Chacko 1 participant 2 messages Jul 10, 2015 – Jul 13, 2015 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Sony Chacko

author Acked-by
#1 lore raw
In reply to a message not in the archive
Quoted 97 lines

-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Wednesday, July 08, 2015 11:31 AM
To: Sony Chacko
Cc: Dept-GE Linux NIC Dev; netdev; linux-kernel
Subject: [PATCH] bnx2:Make various functions to have a return type of void in the file bnx2.c

This makes various functions that never fail nor signal their caller with a error code when a failure occurs to now have a return type of void for the file bnx2.c.

---
 drivers/net/ethernet/broadcom/bnx2.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnx2.c +1 -1
index 2b66ef3..ddf0ccc 100644
@@ -1087,7 +1087,7 @@ bnx2_resolve_flow_ctrl(struct bnx2
 *bp)
 	}
 }
 
-static int
+static void
 bnx2_5709s_linkup(struct bnx2 *bp)
 {
drivers/net/ethernet/broadcom/bnx2.c +7 -12
 	u32 val, speed;
@@ -1101,7 +1101,7 @@ bnx2_5709s_linkup(struct bnx2 *bp)
 	if ((bp->autoneg & AUTONEG_SPEED) == 0) {
 		bp->line_speed = bp->req_line_speed;
 		bp->duplex = bp->req_duplex;
-		return 0;
+		return;
 	}
 	speed = val & MII_BNX2_GP_TOP_AN_SPEED_MSK;
 	switch (speed) {
@@ -1123,10 +1123,9 @@ bnx2_5709s_linkup(struct bnx2 *bp)
 		bp->duplex = DUPLEX_FULL;
 	else
 		bp->duplex = DUPLEX_HALF;
-	return 0;
 }
 
-static int
+static void
 bnx2_5708s_linkup(struct bnx2 *bp)
 {
 	u32 val;
@@ -1152,10 +1151,9 @@ bnx2_5708s_linkup(struct bnx2 *bp)
 	else
 		bp->duplex = DUPLEX_HALF;
 
-	return 0;
 }
 
-static int
+static void
 bnx2_5706s_linkup(struct bnx2 *bp)
 {
 	u32 bmcr, local_adv, remote_adv, common; @@ -1172,7
+1170,7 @@ bnx2_5706s_linkup(struct bnx2 *bp)
 	}
 
 	if (!(bmcr & BMCR_ANENABLE)) {
-		return 0;
+		return;
 	}
 
 	bnx2_read_phy(bp, bp->mii_adv, &local_adv); @@ -1188,11
+1186,9 @@ bnx2_5706s_linkup(struct bnx2 *bp)
 			bp->duplex = DUPLEX_HALF;
 		}
 	}
-
-	return 0;
 }
 
-static int
+static void
 bnx2_copper_linkup(struct bnx2 *bp)
 {
 	u32 bmcr;
@@ -1264,8 +1260,6 @@ bnx2_copper_linkup(struct bnx2 *bp)
 		if (ext_status & EXT_STATUS_MDIX)
 			bp->phy_flags |= BNX2_PHY_FLAG_MDIX;
 	}
-
-	return 0;
 }
 
 static void
--
Quoted 1 line

2.1.4

Thanks,
Sony

#3 lore raw
In reply to a message not in the archive
Quoted 48 lines

Sony,
I also sent this patch and was wondering if I can get a reply on it. From 4a607447562bec161fd947caae5eb02c2365c58a Mon Sep
17 00:00:00 2001
From: Nicholas Krause <[email protected]>
Date: Wed, 8 Jul 2015 08:29:07 -0400
Subject: [PATCH] bnx2i:Fix backwards locking scenario in the function bnx2i_cleanup_task

This fixes the backwards locking scenario for unlocking the bottom half spinlock before calling the wait_for_completion_timeout on the structure pointer bnx2i_conn's member cmd_cleanup_cmpl for the critical region of this function to lock the spin_lock bottom half before unlocking it after the call to this function in order to have actual protection for the function bnx2i_cleanup_task's critical region.

---
 drivers/scsi/bnx2i/bnx2i_iscsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +4 -4
index 7289437..619a26f 100644
@@ -1172,12 +1172,12 @@ static void
 bnx2i_cleanup_task(struct iscsi_task *task)
 	if (task->state == ISCSI_TASK_ABRT_TMF) {
 		bnx2i_send_cmd_cleanup_req(hba, task->dd_data);
 
-		spin_unlock_bh(&conn->session->back_lock);
-		spin_unlock_bh(&conn->session->frwd_lock);
+		spin_lock_bh(&conn->session->back_lock);
+		spin_lock_bh(&conn->session->frwd_lock);
 		wait_for_completion_timeout(&bnx2i_conn-
 >cmd_cleanup_cmpl,
 
 	msecs_to_jiffies(ISCSI_CMD_CLEANUP_TIMEOUT));
-		spin_lock_bh(&conn->session->frwd_lock);
-		spin_lock_bh(&conn->session->back_lock);
+		spin_unlock_bh(&conn->session->frwd_lock);
+		spin_unlock_bh(&conn->session->back_lock);
drivers/scsi/bnx2i/bnx2i_iscsi.c +0 -1
 	}
 	bnx2i_iscsi_unmap_sg_list(task->dd_data);
 }
--
Quoted 3 lines

2.1.4
I am assuming it's wrong but you never known.
Nick

Nick,

I have included the Qlogic ISCSI engineer to the mailing list to review and ACK the patch. I will also follow it up with the ISCSI team.

Thanks,
Sony