summaryrefslogtreecommitdiff
path: root/net/ethtool
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-06-05 14:04:13 +0300
committerDavid S. Miller <davem@davemloft.net>2020-06-05 13:10:02 -0700
commit178f67b1288b6952117fdc4e5ffbd4c4bd4e4a7f (patch)
tree1ec860fb6ae58be98d009b9a5975396b120b6b24 /net/ethtool
parent7d877c35ca84cfa634fd63c2b64bf7b6ae9c71cb (diff)
downloadlwn-178f67b1288b6952117fdc4e5ffbd4c4bd4e4a7f.tar.gz
lwn-178f67b1288b6952117fdc4e5ffbd4c4bd4e4a7f.zip
ethtool: linkinfo: remove an unnecessary NULL check
This code generates a Smatch warning: net/ethtool/linkinfo.c:143 ethnl_set_linkinfo() warn: variable dereferenced before check 'info' (see line 119) Fortunately, the "info" pointer is never NULL so the check can be removed. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool')
-rw-r--r--net/ethtool/linkinfo.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ethtool/linkinfo.c b/net/ethtool/linkinfo.c
index 677068deb68c..5eaf173eaaca 100644
--- a/net/ethtool/linkinfo.c
+++ b/net/ethtool/linkinfo.c
@@ -140,8 +140,7 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
ret = __ethtool_get_link_ksettings(dev, &ksettings);
if (ret < 0) {
- if (info)
- GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
+ GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
goto out_ops;
}
lsettings = &ksettings.base;