diff mbox series

[net] net: qede: Fix end of loop tests for list_for_each_entry

Message ID 20210725175803.60559-1-harshvardhan.jha@oracle.com (mailing list archive)
State Accepted
Commit 795e3d2ea68e489ee7039ac29e98bfea0e34a96c
Delegated to: Netdev Maintainers
Headers show
Series [net] net: qede: Fix end of loop tests for list_for_each_entry | expand

Checks

Context Check Description
netdev/apply success Patch already applied to net
netdev/tree_selection success Clearly marked for net

Commit Message

Harshvardhan Jha July 25, 2021, 5:58 p.m. UTC
The list_for_each_entry() iterator, "vlan" in this code, can never be
NULL so the warning will never be printed.

Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
---
From static analysis.  Not tested.
---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 25, 2021, 10:10 p.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 25 Jul 2021 23:28:04 +0530 you wrote:
> The list_for_each_entry() iterator, "vlan" in this code, can never be
> NULL so the warning will never be printed.
> 
> Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
> ---
> From static analysis.  Not tested.
> 
> [...]

Here is the summary with links:
  - [net] net: qede: Fix end of loop tests for list_for_each_entry
    https://git.kernel.org/netdev/net/c/795e3d2ea68e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index c59b72c90293..a2e4dfb5cb44 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -831,7 +831,7 @@  int qede_configure_vlan_filters(struct qede_dev *edev)
 int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
 {
 	struct qede_dev *edev = netdev_priv(dev);
-	struct qede_vlan *vlan = NULL;
+	struct qede_vlan *vlan;
 	int rc = 0;
 
 	DP_VERBOSE(edev, NETIF_MSG_IFDOWN, "Removing vlan 0x%04x\n", vid);
@@ -842,7 +842,7 @@  int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
 		if (vlan->vid == vid)
 			break;
 
-	if (!vlan || (vlan->vid != vid)) {
+	if (list_entry_is_head(vlan, &edev->vlan_list, list)) {
 		DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
 			   "Vlan isn't configured\n");
 		goto out;