bnx2x:Fix error handling for functions in bnx2x_link.c
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ariel Elior
Acked-byQuoted 78 lines
-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Monday, March 07, 2016 4:12 AM
To: Ariel Elior <[email protected]>
Cc: netdev <[email protected]>; linux-kernel <[email protected]>
Subject: [PATCH 2/2] bnx2x:Fix error handling for functions inbnx2x_link.cThis fixes various functions that call the function
bnx2x_84833_get_reset_gpiosto properly check if this function has returned a error code and if so return immediately with the error code to signal these function'sSigned-off-by Nicholas Krause <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +1
-0@@ -10079,6 +10079,7 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, {struct bnx2x *bp = params->bp;u8 reset_gpios; +int rc; u32 other_shmem_base_addr = REG_RD(bp, params->shmem2_base + offsetof(struct shmem2_region,drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +6
-1other_shmem_base_addr));@@ -10099,7 +10100,12 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, reset_gpios =bnx2x_84833_get_reset_gpios (bp, shmem_base_path, params->chip_id); -bnx2x_set_mult_gpio (bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_LOW); + rc =bnx2x_set_mult_gpio (bp, reset_gpios,MISC_REGISTERS_GPIO_OUTPUT_LOW ); +if (rc) { +DP (NETIF_MSG_LINK ,"84833 hw reset on pin values 0x%x\n failed " , + reset_gpios); +return rc; + }drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +7
-2udelay (10 );DP (NETIF_MSG_LINK ,"84833 hw reset on pin values 0x%x\n" , reset_gpios);@@ -13242,10 +13248,21 @@ static int bnx2x_84833_common_init_phy(struct bnx2x *bp, u32 chip_id) {u8 reset_gpios; +int ret; reset_gpios =bnx2x_84833_get_reset_gpios (bp, shmem_base_path, chip_id); -bnx2x_set_mult_gpio (bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_LOW); + ret =bnx2x_set_mult_gpio (bp, reset_gpios,MISC_REGISTERS_GPIO_OUTPUT_LOW ); +if (ret) { +DP (NETIF_MSG_LINK ,"84833 reset pulse on pin values 0x%x\n" , + reset_gpios); +return ret; + }udelay (10 ); - bnx2x_set_mult_gpio(bp, reset_gpios,
MISC_REGISTERS_GPIO_OUTPUT_HIGH);drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +1
-0+ ret = bnx2x_set_mult_gpio(bp, reset_gpios,
MISC_REGISTERS_GPIO_OUTPUT_HIGH);drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +5
-1+if (ret) { +DP (NETIF_MSG_LINK ,"84833 reset pulse on pin values 0x%x\n" , + reset_gpios); +return ret; + }DP (NETIF_MSG_LINK ,"84833 reset pulse on pin values 0x%x\n" , reset_gpios);return 0 ; --
Quoted 1 line
2.1.4
Thanks Nicholas.
Acked-by Ariel Elior <[email protected]>