[PATCHv2] staging: wilc1000: remove unwanted code

Gujulan Elango, Hari Prasath (H.) hgujulan at visteon.com
Tue Jun 16 07:38:02 UTC 2015


From: Hari Prasath Gujulan Elango <hgujulan at visteon.com>

This patch removes SIOCDEVPRIVATE + 1 ioctl.  It currently is just a
stub which does some useless printks and returns.  In the original code,
if the user passes priv_cmd.total_len == 0 then it will Oops.  Also it
leaks memory every time it's called.  In the future, we will implement
this functionality using generic API functions

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan at visteon.com>
---
	v2: Addressed Dan Carpenters review comments to remove the
entire case statement including the debug print.Also modified the patch
description per his advise.Previously this patch was part of a
patchset,but the other patch got merged.So I am resending this as a
seperate patch as version 2.
---
 drivers/staging/wilc1000/linux_wlan.c | 57 -----------------------------------
 1 file changed, 57 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index c1e9272..8b755a2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -2393,63 +2393,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 	#endif
 
 	switch (cmd) {
-	/* [[ added by tony for SIOCDEVPRIVATE */
-	case SIOCDEVPRIVATE + 1:
-	{
-		android_wifi_priv_cmd priv_cmd;
-
-		PRINT_INFO(GENERIC_DBG, "in SIOCDEVPRIVATE+1\n");
-
-		if (copy_from_user(&priv_cmd, req->ifr_data, sizeof(android_wifi_priv_cmd))) {
-			s32Error = -EFAULT;
-			goto done;
-		}
-
-		buff = kmalloc(priv_cmd.total_len, GFP_KERNEL);
-		if (!buff) {
-			s32Error = -ENOMEM;
-			goto done;
-		}
-
-		if (copy_from_user(buff, priv_cmd.buf, priv_cmd.total_len)) {
-			s32Error = -EFAULT;
-			goto done;
-		}
-
-		PRINT_INFO(GENERIC_DBG, "%s: Android private cmd \"%s\" on %s\n", __FUNCTION__, buff, req->ifr_name);
-
-		if (strncasecmp(buff, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) {
-			PRINT_INFO(GENERIC_DBG, "%s, SCAN-ACTIVE command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, SCAN-PASSIVE command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "RXFILTER-START", strlen("RXFILTER-START")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, RXFILTER-START command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "RXFILTER-STOP", strlen("RXFILTER-STOP")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, RXFILTER-STOP command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "RXFILTER-ADD", strlen("RXFILTER-ADD")) == 0)  {
-			int filter_num = *(buff + strlen("RXFILTER-ADD") + 1) - '0';
-			PRINT_INFO(GENERIC_DBG, "%s, RXFILTER-ADD command, filter_num=%d\n", __FUNCTION__, filter_num);
-		} else if (strncasecmp(buff, "RXFILTER-REMOVE", strlen("RXFILTER-REMOVE")) == 0)  {
-			int filter_num = *(buff + strlen("RXFILTER-REMOVE") + 1) - '0';
-			PRINT_INFO(GENERIC_DBG, "%s, RXFILTER-REMOVE command, filter_num=%d\n", __FUNCTION__, filter_num);
-		} else if (strncasecmp(buff, "BTCOEXSCAN-START", strlen("BTCOEXSCAN-START")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, BTCOEXSCAN-START command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "BTCOEXSCAN-STOP", strlen("BTCOEXSCAN-STOP")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, BTCOEXSCAN-STOP command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, BTCOEXMODE command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "SETBAND", strlen("SETBAND")) == 0)  {
-			uint band = *(buff + strlen("SETBAND") + 1) - '0';
-			PRINT_INFO(GENERIC_DBG, "%s, SETBAND command, band=%d\n", __FUNCTION__, band);
-		} else if (strncasecmp(buff, "GETBAND", strlen("GETBAND")) == 0)  {
-			PRINT_INFO(GENERIC_DBG, "%s, GETBAND command\n", __FUNCTION__);
-		} else if (strncasecmp(buff, "COUNTRY", strlen("COUNTRY")) == 0)  {
-			char *country_code = buff + strlen("COUNTRY") + 1;
-			PRINT_INFO(GENERIC_DBG, "%s, COUNTRY command, country_code=%s\n", __FUNCTION__, country_code);
-		} else {
-			PRINT_INFO(GENERIC_DBG, "%s, Unknown command\n", __FUNCTION__);
-		}
-	} break;
 
 	/* ]] 2013-06-24 */
 	case SIOCSIWPRIV:
-- 
1.9.1


More information about the devel mailing list