diff mbox series

[net,v2] igc: igc_read_phy_reg_gpy: drop premature return

Message ID 20220216133135.356870-1-vinschen@redhat.com
State Accepted
Delegated to: Anthony Nguyen
Headers show
Series [net,v2] igc: igc_read_phy_reg_gpy: drop premature return | expand

Commit Message

Corinna Vinschen Feb. 16, 2022, 1:31 p.m. UTC
igc_read_phy_reg_gpy checks the return value from igc_read_phy_reg_mdic
and if it's not 0, returns immediately. By doing this, it leaves the HW
semaphore in the acquired state.

Drop this premature return statement, the function returns after
releasing the semaphore immediately anyway.

Fixes: 5586838fe9ce ("igc: Add code for PHY support")
Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
---

v2: Add "Fixes:" tag

 drivers/net/ethernet/intel/igc/igc_phy.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Sasha Neftin Feb. 17, 2022, 6:24 a.m. UTC | #1
On 2/16/2022 15:31, Corinna Vinschen wrote:
> igc_read_phy_reg_gpy checks the return value from igc_read_phy_reg_mdic
> and if it's not 0, returns immediately. By doing this, it leaves the HW
> semaphore in the acquired state.
> 
> Drop this premature return statement, the function returns after
> releasing the semaphore immediately anyway.
> 
> Fixes: 5586838fe9ce ("igc: Add code for PHY support")
> Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
> ---
> 
> v2: Add "Fixes:" tag
> 
>   drivers/net/ethernet/intel/igc/igc_phy.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c b/drivers/net/ethernet/intel/igc/igc_phy.c
> index 5cad31c3c7b0..df91d07ce82a 100644
> --- a/drivers/net/ethernet/intel/igc/igc_phy.c
> +++ b/drivers/net/ethernet/intel/igc/igc_phy.c
> @@ -779,8 +779,6 @@ s32 igc_read_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 *data)
>   		if (ret_val)
>   			return ret_val;
>   		ret_val = igc_read_phy_reg_mdic(hw, offset, data);
> -		if (ret_val)
> -			return ret_val;
>   		hw->phy.ops.release(hw);
>   	} else {
>   		ret_val = igc_read_xmdio_reg(hw, (u16)offset, dev_addr,
Thanks Corinna
Acked-by: Sasha Neftin <sasha.neftin@intel.com>
naamax.meir Feb. 23, 2022, 7 a.m. UTC | #2
On 2/16/2022 15:31, Corinna Vinschen wrote:
> igc_read_phy_reg_gpy checks the return value from igc_read_phy_reg_mdic
> and if it's not 0, returns immediately. By doing this, it leaves the HW
> semaphore in the acquired state.
>
> Drop this premature return statement, the function returns after
> releasing the semaphore immediately anyway.
>
> Fixes: 5586838fe9ce ("igc: Add code for PHY support")
> Signed-off-by: Corinna Vinschen<vinschen@redhat.com>
> Acked-by: Sasha Neftin<sasha.neftin@intel.com>
> ---
>
> v2: Add "Fixes:" tag
>
>   drivers/net/ethernet/intel/igc/igc_phy.c | 2 --
>   1 file changed, 2 deletions(-)
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c b/drivers/net/ethernet/intel/igc/igc_phy.c
index 5cad31c3c7b0..df91d07ce82a 100644
--- a/drivers/net/ethernet/intel/igc/igc_phy.c
+++ b/drivers/net/ethernet/intel/igc/igc_phy.c
@@ -779,8 +779,6 @@  s32 igc_read_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 *data)
 		if (ret_val)
 			return ret_val;
 		ret_val = igc_read_phy_reg_mdic(hw, offset, data);
-		if (ret_val)
-			return ret_val;
 		hw->phy.ops.release(hw);
 	} else {
 		ret_val = igc_read_xmdio_reg(hw, (u16)offset, dev_addr,