diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2021-08-05 22:08:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-06 12:39:04 +0300 |
commit | 596690e9f4fc8f062a3f52b42071086721fd76fe (patch) | |
tree | 517fa8847d7ffd2d803fe3b11b8404d93661b78c /net/ethtool | |
parent | 5c0418ed16109759c7aec86b72f9bf56a0358526 (diff) | |
download | linux-596690e9f4fc8f062a3f52b42071086721fd76fe.tar.xz |
ethtool: return error from ethnl_ops_begin if dev is NULL
Julian reported that after d43c65b05b84 Coverity complains about a
missing check whether dev is NULL in ethnl_ops_complete().
There doesn't seem to be any valid case where dev could be NULL when
calling ethnl_ops_begin(), therefore return an error if dev is NULL.
Fixes: d43c65b05b84 ("ethtool: runtime-resume netdev parent in ethnl_ops_begin")
Reported-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool')
-rw-r--r-- | net/ethtool/netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index f8bca08e727e..1797a0a90019 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -35,7 +35,7 @@ int ethnl_ops_begin(struct net_device *dev) int ret; if (!dev) - return 0; + return -ENODEV; if (dev->dev.parent) pm_runtime_get_sync(dev->dev.parent); @@ -61,7 +61,7 @@ err: void ethnl_ops_complete(struct net_device *dev) { - if (dev && dev->ethtool_ops->complete) + if (dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev); if (dev->dev.parent) |