[02/10] common/sfc_efx/base: delete redundant handling

Message ID 1618839289-33224-3-git-send-email-humin29@huawei.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series fixes for clean code |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

humin (Q) April 19, 2021, 1:34 p.m. UTC
  the default case in 'rhead_nic_get_bar_region' is unreachable.

This patch fixed that.

Fixes: 3c1c5cc4a786 ("common/sfc_efx/base: add Riverhead support to NIC module")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/common/sfc_efx/base/rhead_nic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Andrew Rybchenko April 20, 2021, 9:33 a.m. UTC | #1
On 4/19/21 4:34 PM, Min Hu (Connor) wrote:
> the default case in 'rhead_nic_get_bar_region' is unreachable.

Why? May be it is true right now, but default case is required
to handle future changes in enum and missing update here.

> 
> This patch fixed that.
> 
> Fixes: 3c1c5cc4a786 ("common/sfc_efx/base: add Riverhead support to NIC module")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

Nack

> ---
>  drivers/common/sfc_efx/base/rhead_nic.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/common/sfc_efx/base/rhead_nic.c b/drivers/common/sfc_efx/base/rhead_nic.c
> index f2c18c1..b9af348 100644
> --- a/drivers/common/sfc_efx/base/rhead_nic.c
> +++ b/drivers/common/sfc_efx/base/rhead_nic.c
> @@ -483,8 +483,7 @@ rhead_nic_get_bar_region(
>  		break;
>  
>  	default:
> -		rc = EINVAL;
> -		goto fail1;
> +		break;
>  	}
>  
>  	return (0);
>
  
humin (Q) April 20, 2021, 9:42 a.m. UTC | #2
在 2021/4/20 17:33, Andrew Rybchenko 写道:
> On 4/19/21 4:34 PM, Min Hu (Connor) wrote:
>> the default case in 'rhead_nic_get_bar_region' is unreachable.
> 
> Why? May be it is true right now, but default case is required
> to handle future changes in enum and missing update here.
> 
Well, agreed, this patch can be abandoned.
>>
>> This patch fixed that.
>>
>> Fixes: 3c1c5cc4a786 ("common/sfc_efx/base: add Riverhead support to NIC module")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> 
> Nack
> 
>> ---
>>   drivers/common/sfc_efx/base/rhead_nic.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/common/sfc_efx/base/rhead_nic.c b/drivers/common/sfc_efx/base/rhead_nic.c
>> index f2c18c1..b9af348 100644
>> --- a/drivers/common/sfc_efx/base/rhead_nic.c
>> +++ b/drivers/common/sfc_efx/base/rhead_nic.c
>> @@ -483,8 +483,7 @@ rhead_nic_get_bar_region(
>>   		break;
>>   
>>   	default:
>> -		rc = EINVAL;
>> -		goto fail1;
>> +		break;
>>   	}
>>   
>>   	return (0);
>>
> 
> .
>
  

Patch

diff --git a/drivers/common/sfc_efx/base/rhead_nic.c b/drivers/common/sfc_efx/base/rhead_nic.c
index f2c18c1..b9af348 100644
--- a/drivers/common/sfc_efx/base/rhead_nic.c
+++ b/drivers/common/sfc_efx/base/rhead_nic.c
@@ -483,8 +483,7 @@  rhead_nic_get_bar_region(
 		break;
 
 	default:
-		rc = EINVAL;
-		goto fail1;
+		break;
 	}
 
 	return (0);