lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 30 Aug 2013 01:06:53 +0200
From:	Francois Romieu <romieu@...zoreil.com>
To:	liujunliang_ljl@....com
Cc:	davem@...emloft.net, horms@...ge.net.au, joe@...ches.com,
	gregkh@...uxfoundation.org, netdev@...r.kernel.org,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	sunhecheng@....126.com
Subject: Re: [PATCH] USB2NET : SR9700 : One Chip USB 1.1 USB2NET SR9700
 Device Driver Support

Keep it small though literate.

---
 drivers/net/usb/sr9700.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index f7f46e6..3f05b35 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -71,31 +71,25 @@ static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
 
 static int wait_phy_eeprom_ready(struct usbnet *dev, int phy)
 {
-	int i, ret;
+	int i;
 
-	ret = 0;
 	for (i = 0; i < SR_SHARE_TIMEOUT; i++) {
 		u8 tmp = 0;
+		int ret;
 
 		udelay(1);
 		ret = sr_read_reg(dev, EPCR, &tmp);
 		if (ret < 0)
-			goto out;
+			return ret;
 
 		/* ready */
-		if ((tmp & EPCR_ERRE) == 0)
-			break;
+		if (!(tmp & EPCR_ERRE))
+			return 0;
 	}
 
-	if (i >= SR_SHARE_TIMEOUT) {
-		netdev_err(dev->net, "%s write timed out!\n",
-			   phy ? "phy" : "eeprom");
-		ret = -EIO;
-		goto out;
-	}
+	netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom");
 
-out:
-	return ret;
+	return -EIO;
 }
 
 static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
@@ -110,7 +104,7 @@ static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
 
 	ret = wait_phy_eeprom_ready(dev, phy);
 	if (ret < 0)
-		goto out;
+		goto out_unlock;
 
 	sr_write_reg(dev, EPCR, 0x0);
 	ret = sr_read(dev, EPDR, 2, value);
@@ -118,7 +112,7 @@ static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg,
 	netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n",
 		   phy, reg, *value, ret);
 
-out:
+out_unlock:
 	mutex_unlock(&dev->phy_mutex);
 	return ret;
 }
@@ -132,18 +126,18 @@ static int sr_share_write_word(struct usbnet *dev, int phy, u8 reg,
 
 	ret = sr_write(dev, EPDR, 2, &value);
 	if (ret < 0)
-		goto out;
+		goto out_unlock;
 
 	sr_write_reg(dev, EPAR, phy ? (reg | 0x40) : reg);
 	sr_write_reg(dev, EPCR, phy ? 0x1a : 0x12);
 
 	ret = wait_phy_eeprom_ready(dev, phy);
 	if (ret < 0)
-		goto out;
+		goto out_unlock;
 
 	sr_write_reg(dev, EPCR, 0x0);
 
-out:
+out_unlock:
 	mutex_unlock(&dev->phy_mutex);
 	return ret;
 }
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ