Skip to content

Commit 0dcc53a

Browse files
Su HuiPaolo Abeni
authored andcommitted
net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
Clang static checker (scan-build) warning: net/ethtool/ioctl.c:line 2233, column 2 Called function pointer is null (null dereference). Return '-EOPNOTSUPP' when 'ops->get_ethtool_phy_stats' is NULL to fix this typo error. Fixes: 201ed31 ("net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers") Signed-off-by: Su Hui <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Hariprasad Kelam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent b01e1c0 commit 0dcc53a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ethtool/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ static int ethtool_get_phy_stats_ethtool(struct net_device *dev,
22202220
const struct ethtool_ops *ops = dev->ethtool_ops;
22212221
int n_stats, ret;
22222222

2223-
if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats)
2223+
if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats)
22242224
return -EOPNOTSUPP;
22252225

22262226
n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);

0 commit comments

Comments
 (0)