Linux-libre 3.10.80-gnu
[librecmc/linux-libre.git] / drivers / staging / csr / csr_wifi_sme_free_upstream_contents.c
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2011
4             All rights reserved and confidential information of CSR
5
6             Refer to LICENSE.txt included with this source for details
7             on the license terms.
8
9 *****************************************************************************/
10
11 /* Note: this is an auto-generated file. */
12 #include <linux/slab.h>
13 #include "csr_wifi_sme_prim.h"
14 #include "csr_wifi_sme_lib.h"
15
16 /*----------------------------------------------------------------------------*
17  *  NAME
18  *      CsrWifiSmeFreeUpstreamMessageContents
19  *
20  *  DESCRIPTION
21  *
22  *
23  *  PARAMETERS
24  *      eventClass: only the value CSR_WIFI_SME_PRIM will be handled
25  *      message:    the message to free
26  *----------------------------------------------------------------------------*/
27 void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message)
28 {
29     if (eventClass != CSR_WIFI_SME_PRIM)
30     {
31         return;
32     }
33     if (NULL == message)
34     {
35         return;
36     }
37
38     switch (*((CsrWifiSmePrim *) message))
39     {
40         case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND:
41         {
42             CsrWifiSmeAssociationCompleteInd *p = (CsrWifiSmeAssociationCompleteInd *)message;
43             kfree(p->connectionInfo.beaconFrame);
44             p->connectionInfo.beaconFrame = NULL;
45             kfree(p->connectionInfo.associationReqFrame);
46             p->connectionInfo.associationReqFrame = NULL;
47             kfree(p->connectionInfo.associationRspFrame);
48             p->connectionInfo.associationRspFrame = NULL;
49             kfree(p->connectionInfo.assocScanInfoElements);
50             p->connectionInfo.assocScanInfoElements = NULL;
51             kfree(p->connectionInfo.assocReqInfoElements);
52             p->connectionInfo.assocReqInfoElements = NULL;
53             kfree(p->connectionInfo.assocRspInfoElements);
54             p->connectionInfo.assocRspInfoElements = NULL;
55             break;
56         }
57         case CSR_WIFI_SME_BLACKLIST_CFM:
58         {
59             CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message;
60             kfree(p->getAddresses);
61             p->getAddresses = NULL;
62             break;
63         }
64         case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM:
65         {
66             CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message;
67             kfree(p->calibrationData);
68             p->calibrationData = NULL;
69             break;
70         }
71         case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM:
72         {
73             CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message;
74             kfree(p->connectionConfig.mlmeAssociateReqInformationElements);
75             p->connectionConfig.mlmeAssociateReqInformationElements = NULL;
76             break;
77         }
78         case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM:
79         {
80             CsrWifiSmeConnectionInfoGetCfm *p = (CsrWifiSmeConnectionInfoGetCfm *)message;
81             kfree(p->connectionInfo.beaconFrame);
82             p->connectionInfo.beaconFrame = NULL;
83             kfree(p->connectionInfo.associationReqFrame);
84             p->connectionInfo.associationReqFrame = NULL;
85             kfree(p->connectionInfo.associationRspFrame);
86             p->connectionInfo.associationRspFrame = NULL;
87             kfree(p->connectionInfo.assocScanInfoElements);
88             p->connectionInfo.assocScanInfoElements = NULL;
89             kfree(p->connectionInfo.assocReqInfoElements);
90             p->connectionInfo.assocReqInfoElements = NULL;
91             kfree(p->connectionInfo.assocRspInfoElements);
92             p->connectionInfo.assocRspInfoElements = NULL;
93             break;
94         }
95         case CSR_WIFI_SME_MEDIA_STATUS_IND:
96         {
97             CsrWifiSmeMediaStatusInd *p = (CsrWifiSmeMediaStatusInd *)message;
98             kfree(p->connectionInfo.beaconFrame);
99             p->connectionInfo.beaconFrame = NULL;
100             kfree(p->connectionInfo.associationReqFrame);
101             p->connectionInfo.associationReqFrame = NULL;
102             kfree(p->connectionInfo.associationRspFrame);
103             p->connectionInfo.associationRspFrame = NULL;
104             kfree(p->connectionInfo.assocScanInfoElements);
105             p->connectionInfo.assocScanInfoElements = NULL;
106             kfree(p->connectionInfo.assocReqInfoElements);
107             p->connectionInfo.assocReqInfoElements = NULL;
108             kfree(p->connectionInfo.assocRspInfoElements);
109             p->connectionInfo.assocRspInfoElements = NULL;
110             break;
111         }
112         case CSR_WIFI_SME_MIB_GET_CFM:
113         {
114             CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message;
115             kfree(p->mibAttribute);
116             p->mibAttribute = NULL;
117             break;
118         }
119         case CSR_WIFI_SME_MIB_GET_NEXT_CFM:
120         {
121             CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message;
122             kfree(p->mibAttribute);
123             p->mibAttribute = NULL;
124             break;
125         }
126         case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM:
127         {
128             CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message;
129             kfree(p->getAddresses);
130             p->getAddresses = NULL;
131             break;
132         }
133         case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND:
134         {
135             CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message;
136             kfree(p->pmkidCandidates);
137             p->pmkidCandidates = NULL;
138             break;
139         }
140         case CSR_WIFI_SME_PMKID_CFM:
141         {
142             CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message;
143             kfree(p->getPmkids);
144             p->getPmkids = NULL;
145             break;
146         }
147         case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM:
148         {
149             CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message;
150             kfree(p->scanConfig.passiveChannelList);
151             p->scanConfig.passiveChannelList = NULL;
152             break;
153         }
154         case CSR_WIFI_SME_SCAN_RESULT_IND:
155         {
156             CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message;
157             kfree(p->result.informationElements);
158             p->result.informationElements = NULL;
159             switch (p->result.p2pDeviceRole)
160             {
161                 case CSR_WIFI_SME_P2P_ROLE_GO:
162                 {
163                     u16 i4;
164                     for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
165                     {
166                         kfree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
167                         p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
168                     }
169                 }
170                     kfree(p->result.deviceInfo.groupInfo.p2PClientInfo);
171                     p->result.deviceInfo.groupInfo.p2PClientInfo = NULL;
172                     break;
173                 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
174                     kfree(p->result.deviceInfo.standalonedevInfo.secDeviceType);
175                     p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL;
176                     break;
177                 default:
178                     break;
179             }
180             break;
181         }
182         case CSR_WIFI_SME_SCAN_RESULTS_GET_CFM:
183         {
184             CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message;
185             {
186                 u16 i1;
187                 for (i1 = 0; i1 < p->scanResultsCount; i1++)
188                 {
189                     kfree(p->scanResults[i1].informationElements);
190                     p->scanResults[i1].informationElements = NULL;
191                     switch (p->scanResults[i1].p2pDeviceRole)
192                     {
193                         case CSR_WIFI_SME_P2P_ROLE_GO:
194                         {
195                             u16 i4;
196                             for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
197                             {
198                                 kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
199                                 p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
200                             }
201                         }
202                             kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo);
203                             p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL;
204                             break;
205                         case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
206                             kfree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType);
207                             p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL;
208                             break;
209                         default:
210                             break;
211                     }
212                 }
213             }
214             kfree(p->scanResults);
215             p->scanResults = NULL;
216             break;
217         }
218         case CSR_WIFI_SME_TSPEC_IND:
219         {
220             CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message;
221             kfree(p->tspec);
222             p->tspec = NULL;
223             break;
224         }
225         case CSR_WIFI_SME_TSPEC_CFM:
226         {
227             CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message;
228             kfree(p->tspec);
229             p->tspec = NULL;
230             break;
231         }
232         case CSR_WIFI_SME_VERSIONS_GET_CFM:
233         {
234             CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message;
235             kfree(p->versions.routerBuild);
236             p->versions.routerBuild = NULL;
237             kfree(p->versions.smeBuild);
238             p->versions.smeBuild = NULL;
239             break;
240         }
241         case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM:
242         {
243             CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message;
244             kfree(p->cloakedSsids.cloakedSsids);
245             p->cloakedSsids.cloakedSsids = NULL;
246             break;
247         }
248         case CSR_WIFI_SME_ERROR_IND:
249         {
250             CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message;
251             kfree(p->errorMessage);
252             p->errorMessage = NULL;
253             break;
254         }
255         case CSR_WIFI_SME_INFO_IND:
256         {
257             CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message;
258             kfree(p->infoMessage);
259             p->infoMessage = NULL;
260             break;
261         }
262         case CSR_WIFI_SME_CORE_DUMP_IND:
263         {
264             CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message;
265             kfree(p->data);
266             p->data = NULL;
267             break;
268         }
269
270         default:
271             break;
272     }
273 }
274
275