* [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object
@ 2025-06-16 4:50 Ваторопин Андрей
2025-06-16 22:11 ` Jacob Keller
2025-06-19 10:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ваторопин Андрей @ 2025-06-16 4:50 UTC (permalink / raw)
To: Tariq Toukan
Cc: Ваторопин Андрей,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
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>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
---
Resend for net-next. Link to initial thread:
https://lore.kernel.org/netdev/20250401061439.9978-1-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));
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object
2025-06-16 4:50 [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object Ваторопин Андрей
@ 2025-06-16 22:11 ` Jacob Keller
2025-06-19 10:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jacob Keller @ 2025-06-16 22:11 UTC (permalink / raw)
To: Ваторопин Андрей,
Tariq Toukan
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
On 6/15/2025 9:50 PM, Ваторопин Андрей 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>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> ---
> Resend for net-next. Link to initial thread:
> https://lore.kernel.org/netdev/20250401061439.9978-1-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));
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object
2025-06-16 4:50 [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object Ваторопин Андрей
2025-06-16 22:11 ` Jacob Keller
@ 2025-06-19 10:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-19 10:10 UTC (permalink / raw)
To: =?utf-8?b?0JLQsNGC0L7RgNC+0L/QuNC9INCQ0L3QtNGA0LXQuSA8YS52YXRvcm9waW5AY3Jw?=,
=?utf-8?b?dC5ydT4=?=
Cc: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-rdma, linux-kernel, lvc-project
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 16 Jun 2025 04:50:44 +0000 you 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.
>
> [...]
Here is the summary with links:
- [net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object
https://git.kernel.org/netdev/net-next/c/f6be1f290c65
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-19 10:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 4:50 [PATCH net-next] net/mlx4_en: Remove the redundant NULL check for the 'my_ets' object Ваторопин Андрей
2025-06-16 22:11 ` Jacob Keller
2025-06-19 10:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).