[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190201082406.GA8459@kadam>
Date: Fri, 1 Feb 2019 11:24:06 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "David S. Miller" <davem@...emloft.net>,
Yunsheng Lin <linyunsheng@...wei.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Wenwen Wang <wang6495@....edu>,
Boris Pismenny <borisp@...lanox.com>,
Ilya Lesokhin <ilyal@...lanox.com>,
Edward Cree <ecree@...arflare.com>,
Michal Kubecek <mkubecek@...e.cz>,
Yury Norov <ynorov@...iumnetworks.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH net] 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@...cle.com>
---
net/core/ethtool.c | 9 +++------
1 file 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, ®s, regbuf);
--
2.17.1
Powered by blists - more mailing lists