diff mbox series

net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object

Message ID 20250401061439.9978-1-a.vatoropin@crpt.ru (mailing list archive)
State Not Applicable
Headers show
Series net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object | expand

Commit Message

Ваторопин Андрей April 1, 2025, 6:15 a.m. UTC
From: Andrey Vatoropin <a.vatoropin@crpt.ru>

Static analysis shows that pointer "my_ets" cannot be NULL because it 
points to the object "struct ieee_ets".

Remove the extra NULL check. It is meaningless and harms the readability
of the code.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
---
 drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Paolo Abeni April 1, 2025, 10:39 a.m. UTC | #1
On 4/1/25 8:15 AM, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin@crpt.ru>
> 
> Static analysis shows that pointer "my_ets" cannot be NULL because it 
> points to the object "struct ieee_ets".
> 
> Remove the extra NULL check. It is meaningless and harms the readability
> of the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>

## Form letter - net-next-closed

Linus already pulled net-next material v6.15 and therefore net-next is
closed
for new drivers, features, code refactoring and optimizations. We are
currently
accepting bug fixes only.

Please repost when net-next reopens after Apr 7th.

RFC patches sent for review only are obviously welcome at any time.

See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
Tariq Toukan April 2, 2025, 5:36 p.m. UTC | #2
On 01/04/2025 9:15, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin@crpt.ru>
> 
> Static analysis shows that pointer "my_ets" cannot be NULL because it
> points to the object "struct ieee_ets".
> 
> Remove the extra NULL check. It is meaningless and harms the readability
> of the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> index 752a72499b4f..be80da03a594 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> @@ -290,9 +290,6 @@ static int mlx4_en_dcbnl_ieee_getets(struct net_device *dev,
>   	struct mlx4_en_priv *priv = netdev_priv(dev);
>   	struct ieee_ets *my_ets = &priv->ets;
>   
> -	if (!my_ets)
> -		return -EINVAL;
> -
>   	ets->ets_cap = IEEE_8021QAZ_MAX_TCS;
>   	ets->cbs = my_ets->cbs;
>   	memcpy(ets->tc_tx_bw, my_ets->tc_tx_bw, sizeof(ets->tc_tx_bw));

Thanks for your patch.
You can add my tag when you resend, once the submission window opens.

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 752a72499b4f..be80da03a594 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -290,9 +290,6 @@  static int mlx4_en_dcbnl_ieee_getets(struct net_device *dev,
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct ieee_ets *my_ets = &priv->ets;
 
-	if (!my_ets)
-		return -EINVAL;
-
 	ets->ets_cap = IEEE_8021QAZ_MAX_TCS;
 	ets->cbs = my_ets->cbs;
 	memcpy(ets->tc_tx_bw, my_ets->tc_tx_bw, sizeof(ets->tc_tx_bw));