diff --git a/common.cpp b/common.cpp
index b28a815..e0de0bc 100755
--- a/common.cpp
+++ b/common.cpp
@@ -220,7 +220,6 @@
 
     for (int i = 0; i < info->num_cmd; i++) {
         if (info->cmd[i].cmd == cmd) {
-            int id = info->cmd[i].id;
             memmove(&info->cmd[i], &info->cmd[i+1], (info->num_cmd - i) * sizeof(cmd_info));
             info->num_cmd--;
             //ALOGI("Successfully removed command %d: %p from %d", id, cmd, i);
diff --git a/gscan.cpp b/gscan.cpp
index 063ac55..0b77503 100755
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -1,4 +1,3 @@
-
 #include <stdint.h>
 #include <stddef.h>
 #include <fcntl.h>
@@ -81,9 +80,6 @@
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
-
         void *data = reply.get_vendor_data();
         int len = reply.get_vendor_data_len();
 
@@ -140,8 +136,6 @@
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
         int num_channels_to_copy = 0;
 
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
@@ -182,6 +176,7 @@
 
 /* helper functions */
 
+/*
 static int parseScanResults(wifi_scan_result *results, int num, nlattr *attr)
 {
     memset(results, 0, sizeof(wifi_scan_result) * num);
@@ -189,7 +184,6 @@
     int i = 0;
     for (nl_iterator it(attr); it.has_next() && i < num; it.next(), i++) {
 
-        int index = it.get_type();
         nlattr *sc_data = (nlattr *) it.get_data();
         wifi_scan_result *result = results + i;
 
@@ -221,6 +215,7 @@
 
     return i;
 }
+*/
 
 int createFeatureRequest(WifiRequest& request, int subcmd) {
 
@@ -237,12 +232,10 @@
     wifi_scan_cmd_params *mParams;
     wifi_scan_result_handler mHandler;
     static unsigned mGlobalFullScanBuckets;
-    bool mLocalFullScanBuckets;
 public:
     ScanCommand(wifi_interface_handle iface, int id, wifi_scan_cmd_params *params,
                 wifi_scan_result_handler handler)
-        : WifiCommand(iface, id), mParams(params), mHandler(handler),
-          mLocalFullScanBuckets(0)
+        : WifiCommand(iface, id), mParams(params), mHandler(handler)
     { }
 
     int createSetupRequest(WifiRequest& request) {
@@ -479,7 +472,6 @@
     if(id == -1) {
         wifi_scan_result_handler handler;
         wifi_scan_cmd_params dummy_params;
-        wifi_handle handle = getWifiHandle(iface);
         memset(&handler, 0, sizeof(handler));
 
         ScanCommand *cmd = new ScanCommand(iface, id, &dummy_params, handler);
@@ -574,9 +566,6 @@
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
-
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = reply.get_vendor_data_len();
 
@@ -611,8 +600,8 @@
                         num = min((int)MAX_AP_CACHE_PER_SCAN, num);
                         memcpy(mScanResults + mNextScanResult, it2.get_data(),
                                 sizeof(wifi_scan_result) * num);
-                        wifi_scan_result *results = (wifi_scan_result *)it2.get_data();
                         /*
+                        wifi_scan_result *results = (wifi_scan_result *)it2.get_data();
                         for (int i = 0; i < num; i++) {
                             wifi_scan_result *result = results + i;
                             ALOGD("%02d  %-32s  %02x:%02x:%02x:%02x:%02x:%02x  %04d", i,
@@ -1148,7 +1137,6 @@
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        int event_id = event.get_vendor_subcmd();
         // event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
diff --git a/link_layer_stats.cpp b/link_layer_stats.cpp
index cafabb6..bfdeac8 100755
--- a/link_layer_stats.cpp
+++ b/link_layer_stats.cpp
@@ -199,9 +199,7 @@
             return NL_SKIP;
         }
         int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
         u8 *data = (u8 *)reply.get_vendor_data();
-        int len = reply.get_vendor_data_len();
         int num_radios = 0, i = 0;
         num_radios = data[0];
         data += sizeof(data[0]);
diff --git a/roam.cpp b/roam.cpp
index 2f5e8a1..2fe5c26 100755
--- a/roam.cpp
+++ b/roam.cpp
@@ -106,7 +106,6 @@
     wifi_error ret;
     int requestId;
     wifi_bssid_params bssid_params;
-    wifi_handle wifiHandle = getWifiHandle(iface);
 
     if (!roaming_config) {
         ALOGE("%s: Invalid Buffer provided. Exit", __FUNCTION__);
diff --git a/wifi_hal.cpp b/wifi_hal.cpp
index 402c244..b38d333 100755
--- a/wifi_hal.cpp
+++ b/wifi_hal.cpp
@@ -41,7 +41,6 @@
 #define ATTR_NODFS_VALUE             3
 #define ATTR_COUNTRY_CODE            4
 
-static void internal_event_handler(wifi_handle handle, int events);
 static int internal_no_seq_check(nl_msg *msg, void *arg);
 static int internal_valid_message_handler(nl_msg *msg, void *arg);
 static int wifi_get_multicast_id(wifi_handle handle, const char *name, const char *group);
@@ -840,9 +839,6 @@
 protected:
     virtual int handleResponse(WifiEvent& reply) {
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
-
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
             ALOGD("Ignore reply; cmd = %d", reply.get_cmd());
             return NL_SKIP;
@@ -1004,7 +1000,6 @@
 
     if(id == -1) {
         wifi_rssi_event_handler handler;
-        wifi_handle handle = getWifiHandle(iface);
         memset(&handler, 0, sizeof(handler));
         SetRSSIMonitorCommand *cmd = new SetRSSIMonitorCommand(id, iface,
                                                     0, 0, handler);
diff --git a/wifi_logger.cpp b/wifi_logger.cpp
index 03ed87f..0d8eed2 100755
--- a/wifi_logger.cpp
+++ b/wifi_logger.cpp
@@ -380,9 +380,8 @@
             case GET_FEATURE:
             {
                 void *data = reply.get_vendor_data();
-                int len = reply.get_vendor_data_len();
 
-                ALOGD("len = %d, expected len = %d", len, sizeof(unsigned int));
+                ALOGD("len = %d, expected len = %lu", reply.get_vendor_data_len(), (unsigned long)sizeof(unsigned int));
                 memcpy(mSupport, data, sizeof(unsigned int));
                 break;
             }
@@ -677,7 +676,6 @@
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        wifi_ring_buffer_id ring_id;
         char *buffer = NULL;
         int buffer_size = 0;
 
@@ -944,7 +942,7 @@
         for (nl_iterator it(vendor_data); it.has_next(); it.next()) {
             if (it.get_type() == ENHANCE_LOGGER_ATTRIBUTE_PKT_FATE_NUM) {
                 *mNoProvidedFates = it.get_u32();
-                ALOGI("No: of pkt fates provided is %d\n", *mNoProvidedFates);
+                ALOGI("No: of pkt fates provided is %zu\n", *mNoProvidedFates);
             } else {
                 ALOGE("Ignoring invalid attribute type = %d, size = %d\n",
                         it.get_type(), it.get_len());
@@ -1174,6 +1172,16 @@
                            it.get_type(), it.get_len());
                      }
                  }
+	    case GET_FW_VER:
+            case GET_DRV_VER:
+            case GET_RING_DATA:
+            case GET_RING_STATUS:
+            case GET_FEATURE:
+            case START_RING_LOG:
+            default:
+                   {
+                          ALOGW("Ignoring GetCmdType %d \n", mType);
+                   }
             }
         return NL_OK;
     }
