From: Peter Wu <lekensteyn@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>,
Francois Romieu <romieu@fr.zoreil.com>
Cc: lekensteyn@gmail.com, netdev@vger.kernel.org
Subject: [PATCH] r8169,sis190: remove unnecessary length check
Date: Sat, 17 Aug 2013 01:07:53 +0200 [thread overview]
Message-ID: <1376694473-8517-1-git-send-email-lekensteyn@gmail.com> (raw)
The ethtool core will lower the requested length to the one returned by
get_regs_len, therefore no additional check is needed in the get_regs
function.
Reported-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
---
Hi,
This was observed by Ben[1] while reviewing my other r8169 register dump
patch. I have combined the r8169 and sis190 patches since they were
trivial and both maintained by Francois. Let me know if you prefer to
split this trivial patch up.
Regards,
Peter
[1]: http://www.spinics.net/lists/netdev/msg246690.html
---
drivers/net/ethernet/realtek/r8169.c | 3 ---
drivers/net/ethernet/sis/sis190.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index b5eb419..93ee49d 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1898,9 +1898,6 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
{
struct rtl8169_private *tp = netdev_priv(dev);
- if (regs->len > R8169_REGS_SIZE)
- regs->len = R8169_REGS_SIZE;
-
rtl_lock_work(tp);
memcpy_fromio(p, tp->mmio_addr, regs->len);
rtl_unlock_work(tp);
diff --git a/drivers/net/ethernet/sis/sis190.c b/drivers/net/ethernet/sis/sis190.c
index 02df089..ee18e6f 100644
--- a/drivers/net/ethernet/sis/sis190.c
+++ b/drivers/net/ethernet/sis/sis190.c
@@ -1770,9 +1770,6 @@ static void sis190_get_regs(struct net_device *dev, struct ethtool_regs *regs,
struct sis190_private *tp = netdev_priv(dev);
unsigned long flags;
- if (regs->len > SIS190_REGS_SIZE)
- regs->len = SIS190_REGS_SIZE;
-
spin_lock_irqsave(&tp->lock, flags);
memcpy_fromio(p, tp->mmio_addr, regs->len);
spin_unlock_irqrestore(&tp->lock, flags);
--
1.8.3.4
next reply other threads:[~2013-08-17 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 23:07 Peter Wu [this message]
2013-08-20 20:45 ` [PATCH] r8169,sis190: remove unnecessary length check Francois Romieu
2013-08-20 21:58 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376694473-8517-1-git-send-email-lekensteyn@gmail.com \
--to=lekensteyn@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).