Skip to content

Commit be39b27

Browse files
author
Hangbin Liu
committed
team: Remove NULL check before dev_{put, hold}
JIRA: https://issues.redhat.com/browse/RHEL-31052 Upstream Status: net.git commit 64a3727 commit 64a3727 Author: Yang Li <yang.lee@linux.alibaba.com> Date: Thu Jul 27 08:57:41 2023 +0800 team: Remove NULL check before dev_{put, hold} The call netdev_{put, hold} of dev_{put, hold} will check NULL, so there is no need to check before using dev_{put, hold}, remove it to silence the warning: ./drivers/net/team/team.c:2325:3-10: WARNING: NULL check before dev_{put, hold} functions is not needed. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5991 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Hangbin Liu <haliu@redhat.com>
1 parent b3dc398 commit be39b27

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/team/team.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,8 +2331,7 @@ static struct team *team_nl_team_get(struct genl_info *info)
23312331
ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
23322332
dev = dev_get_by_index(net, ifindex);
23332333
if (!dev || dev->netdev_ops != &team_netdev_ops) {
2334-
if (dev)
2335-
dev_put(dev);
2334+
dev_put(dev);
23362335
return NULL;
23372336
}
23382337

0 commit comments

Comments
 (0)