[PATCH] [NET] libertas: check for mesh support before trying to use it

Sebastian Siewior liber+tas at ml.breakpoint.cc
Sat May 10 03:24:28 EDT 2008


From: Sebastian Siewior <sebastian at breakpoint.cc>

This will prevent the execution of lbs_ethtool_get_stats() via ethtool -S
if there is no mesh support.

Signed-off-by: Sebastian Siewior <sebastian at breakpoint.cc>
---
Dan, this will test prevent the usage of ethtool -S in case there is no
mesh support. If you fine with this than we could apply my or David's
other patch to enable the function again and then worry about the error
path.
David: I saw your patch that is doing this in a other way but I thing
that one looks better :)

 drivers/net/wireless/libertas/ethtool.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index dcfdb40..a79d698 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -113,8 +113,14 @@ static void lbs_ethtool_get_stats(struct net_device * dev,
 
 static int lbs_ethtool_get_sset_count(struct net_device * dev, int sset)
 {
+	struct lbs_private *priv = dev->priv;
+
 	switch (sset) {
 	case ETH_SS_STATS:
+
+		if (!priv->mesh_tlv)
+			return -EOPNOTSUPP;
+
 		return MESH_STATS_NUM;
 	default:
 		return -EOPNOTSUPP;
-- 
1.5.4.3




More information about the libertas-dev mailing list