net: Remove redundant if statements

The 'if (dev)' statement already move into dev_{put , hold}, so remove
redundant if statements.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Yajun Deng 2021-08-05 19:55:27 +08:00 committed by David S. Miller
parent a85b99ab6a
commit 1160dfa178
39 changed files with 82 additions and 168 deletions

View file

@ -340,8 +340,7 @@ nla_put_failure:
out_dev:
wpan_phy_put(phy);
out:
if (dev)
dev_put(dev);
dev_put(dev);
return rc;
}

View file

@ -2226,8 +2226,7 @@ static void nl802154_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
if (ops->internal_flags & NL802154_FLAG_NEED_WPAN_DEV) {
struct wpan_dev *wpan_dev = info->user_ptr[1];
if (wpan_dev->netdev)
dev_put(wpan_dev->netdev);
dev_put(wpan_dev->netdev);
} else {
dev_put(info->user_ptr[1]);
}

View file

@ -41,8 +41,7 @@ ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr)
ieee802154_devaddr_to_raw(hwaddr, addr->extended_addr);
rcu_read_lock();
dev = dev_getbyhwaddr_rcu(net, ARPHRD_IEEE802154, hwaddr);
if (dev)
dev_hold(dev);
dev_hold(dev);
rcu_read_unlock();
break;
case IEEE802154_ADDR_SHORT: