Skip to contentSkip to conversation

USB: mcs7830: return negative if auto negotiate fails

PATCH Applied Dan Carpenter 2 participants 2 messages Dec 17, 2010 – Dec 23, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: mcs7830: return negative if auto negotiate fails

The original code returns 0 on success and 1 on failure. In fact, at this point, "ret" is already either zero or a negative error code so we can just return it directly.

drivers/net/usb/mcs7830.c +1 -1
index a6281e3..f3fe8e1 100644
@@ -351,7 +351,7 @@ static int mcs7830_set_autoneg(struct usbnet *dev, int ptrUserPhyMode)
 	if (!ret)
 		ret = mcs7830_write_phy(dev, MII_BMCR,
 				BMCR_ANENABLE | BMCR_ANRESTART	);
-	return ret < 0 ? : 0;
+	return ret;
 }
 
 
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Fri, 17 Dec 2010 16:25:43 +0300

Quoted 5 lines

The original code returns 0 on success and 1 on failure. In fact, at this point, "ret" is already either zero or a negative error code so we can just return it directly.

Indeed, the USBNET ->bind() method, which this return value propagates to, expects negative return values on error.

Applied, and queued up for -stable, thanks Dan.