summaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-02-01 09:24:06 +0100
committerDavid S. Miller <davem@davemloft.net>2019-02-01 18:58:07 +0100
commitef76c77a0561e83d457937621ce2273b0580e345 (patch)
tree9252d830ded234562c5d61477d0092410de54fd7 /net/core/ethtool.c
parentr8169: improve WoL handling (diff)
downloadlinux-ef76c77a0561e83d457937621ce2273b0580e345.tar.xz
linux-ef76c77a0561e83d457937621ce2273b0580e345.zip
ethtool: remove unnecessary check in ethtool_get_regs()
We recently changed this function in commit f9fc54d313fa ("ethtool: check the return value of get_regs_len") such that if "reglen" is zero we return directly. That means we can remove this condition as well. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 158264f7cfaf..3fe6e9da3579 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1348,12 +1348,9 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
if (regs.len > reglen)
regs.len = reglen;
- regbuf = NULL;
- if (reglen) {
- regbuf = vzalloc(reglen);
- if (!regbuf)
- return -ENOMEM;
- }
+ regbuf = vzalloc(reglen);
+ if (!regbuf)
+ return -ENOMEM;
ops->get_regs(dev, &regs, regbuf);