Skip to content

Commit

Permalink
ipv4: Remove redundant !ifa->ifa_dev check.
Browse files Browse the repository at this point in the history
Now, ifa_dev is only set in inet_alloc_ifa() and never
NULL after ifa gets visible.

Let's remove the unneeded NULL check for ifa->ifa_dev.

Signed-off-by: Kuniyuki Iwashima <[email protected]>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
q2ven authored and NipaLocal committed Aug 13, 2024
1 parent e2eeb0e commit 802a4b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3185,8 +3185,7 @@ netxen_list_config_ip(struct netxen_adapter *adapter,
struct list_head *head;
bool ret = false;

dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL;

dev = ifa->ifa_dev->dev;
if (dev == NULL)
goto out;

Expand Down Expand Up @@ -3379,7 +3378,7 @@ netxen_inetaddr_event(struct notifier_block *this,
struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
unsigned long ip_event;

dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL;
dev = ifa->ifa_dev->dev;
ip_event = (event == NETDEV_UP) ? NX_IP_UP : NX_IP_DOWN;
recheck:
if (dev == NULL)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,7 @@ qlcnic_inetaddr_event(struct notifier_block *this,

struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;

dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL;
dev = ifa->ifa_dev->dev;

recheck:
if (dev == NULL)
Expand Down
3 changes: 1 addition & 2 deletions net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ static void inet_rcu_free_ifa(struct rcu_head *head)
{
struct in_ifaddr *ifa = container_of(head, struct in_ifaddr, rcu_head);

if (ifa->ifa_dev)
in_dev_put(ifa->ifa_dev);
in_dev_put(ifa->ifa_dev);
kfree(ifa);
}

Expand Down

0 comments on commit 802a4b2

Please sign in to comment.