Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599947

[PATCH net-next 09/12] net: bcmgenet: return EOPNOTSUPP for unknown ioctl commands

From Doug Berger <opendmb@gmail.com>
Newsgroups linux.kernel
Subject [PATCH net-next 09/12] net: bcmgenet: return EOPNOTSUPP for unknown ioctl commands
Date 2017-03-14 01:50 +0100
Message-ID <tkIP0-AW-23@gated-at.bofh.it> (permalink)
References <tkIOZ-AW-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This commit changes the ioctl handling behavior to return the
EOPNOTSUPP error code instead of the EINVAL error code when an
unknown ioctl command value is detected.

It also removes some redundant parsing of the ioctl command value
and allows the SIOCSHWTSTAMP value to be handled.

Signed-off-by: Doug Berger <opendmb@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index d90d366b286f..3b49c14128e2 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1062,27 +1062,14 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
 static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
-	int val = 0;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
-	switch (cmd) {
-	case SIOCGMIIPHY:
-	case SIOCGMIIREG:
-	case SIOCSMIIREG:
-		if (!priv->phydev)
-			val = -ENODEV;
-		else
-			val = phy_mii_ioctl(priv->phydev, rq, cmd);
-		break;
-
-	default:
-		val = -EINVAL;
-		break;
-	}
+	if (!priv->phydev)
+		return -ENODEV;
 
-	return val;
+	return phy_mii_ioctl(priv->phydev, rq, cmd);
 }
 
 static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
-- 
2.11.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH net-next 09/12] net: bcmgenet: return EOPNOTSUPP for unknown ioctl commands Doug Berger <opendmb@gmail.com> - 2017-03-14 01:50 +0100
  RE: [PATCH net-next 09/12] net: bcmgenet: return EOPNOTSUPP for  unknown ioctl commands David Laight <David.Laight@ACULAB.COM> - 2017-03-14 12:10 +0100
    Re: [PATCH net-next 09/12] net: bcmgenet: return EOPNOTSUPP for  unknown ioctl commands Doug Berger <opendmb@gmail.com> - 2017-03-14 18:40 +0100

csiph-web