csr_wifi_sme_free_upstream_contents.c 10.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*****************************************************************************

            (c) Cambridge Silicon Radio Limited 2011
            All rights reserved and confidential information of CSR

            Refer to LICENSE.txt included with this source for details
            on the license terms.

*****************************************************************************/

/* Note: this is an auto-generated file. */
12
#include <linux/slab.h>
13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include "csr_wifi_sme_prim.h"
#include "csr_wifi_sme_lib.h"

/*----------------------------------------------------------------------------*
 *  NAME
 *      CsrWifiSmeFreeUpstreamMessageContents
 *
 *  DESCRIPTION
 *
 *
 *  PARAMETERS
 *      eventClass: only the value CSR_WIFI_SME_PRIM will be handled
 *      message:    the message to free
 *----------------------------------------------------------------------------*/
27
void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message)
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
{
    if (eventClass != CSR_WIFI_SME_PRIM)
    {
        return;
    }
    if (NULL == message)
    {
        return;
    }

    switch (*((CsrWifiSmePrim *) message))
    {
        case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND:
        {
            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 55 56 57 58 59
            p->connectionInfo.assocRspInfoElements = NULL;
            break;
        }
        case CSR_WIFI_SME_BLACKLIST_CFM:
        {
            CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message;
60
            kfree(p->getAddresses);
61 62 63 64 65 66
            p->getAddresses = NULL;
            break;
        }
        case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM:
        {
            CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message;
67
            kfree(p->calibrationData);
68 69 70 71 72 73
            p->calibrationData = NULL;
            break;
        }
        case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM:
        {
            CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message;
74
            kfree(p->connectionConfig.mlmeAssociateReqInformationElements);
75 76 77 78 79 80
            p->connectionConfig.mlmeAssociateReqInformationElements = NULL;
            break;
        }
        case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM:
        {
            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 93 94 95 96 97
            p->connectionInfo.assocRspInfoElements = NULL;
            break;
        }
        case CSR_WIFI_SME_MEDIA_STATUS_IND:
        {
            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 110 111 112 113 114
            p->connectionInfo.assocRspInfoElements = NULL;
            break;
        }
        case CSR_WIFI_SME_MIB_GET_CFM:
        {
            CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message;
115
            kfree(p->mibAttribute);
116 117 118 119 120 121
            p->mibAttribute = NULL;
            break;
        }
        case CSR_WIFI_SME_MIB_GET_NEXT_CFM:
        {
            CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message;
122
            kfree(p->mibAttribute);
123 124 125 126 127 128
            p->mibAttribute = NULL;
            break;
        }
        case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM:
        {
            CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message;
129
            kfree(p->getAddresses);
130 131 132 133 134 135
            p->getAddresses = NULL;
            break;
        }
        case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND:
        {
            CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message;
136
            kfree(p->pmkidCandidates);
137 138 139 140 141 142
            p->pmkidCandidates = NULL;
            break;
        }
        case CSR_WIFI_SME_PMKID_CFM:
        {
            CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message;
143
            kfree(p->getPmkids);
144 145 146 147 148 149
            p->getPmkids = NULL;
            break;
        }
        case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM:
        {
            CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message;
150
            kfree(p->scanConfig.passiveChannelList);
151 152 153 154 155 156
            p->scanConfig.passiveChannelList = NULL;
            break;
        }
        case CSR_WIFI_SME_SCAN_RESULT_IND:
        {
            CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message;
157
            kfree(p->result.informationElements);
158 159 160 161 162
            p->result.informationElements = NULL;
            switch (p->result.p2pDeviceRole)
            {
                case CSR_WIFI_SME_P2P_ROLE_GO:
                {
163
                    u16 i4;
164 165
                    for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
                    {
166
                        kfree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
167 168 169
                        p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
                    }
                }
170
                    kfree(p->result.deviceInfo.groupInfo.p2PClientInfo);
171 172 173
                    p->result.deviceInfo.groupInfo.p2PClientInfo = NULL;
                    break;
                case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
174
                    kfree(p->result.deviceInfo.standalonedevInfo.secDeviceType);
175 176 177 178 179 180 181 182 183 184 185
                    p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL;
                    break;
                default:
                    break;
            }
            break;
        }
        case CSR_WIFI_SME_SCAN_RESULTS_GET_CFM:
        {
            CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message;
            {
186
                u16 i1;
187 188
                for (i1 = 0; i1 < p->scanResultsCount; i1++)
                {
189
                    kfree(p->scanResults[i1].informationElements);
190 191 192 193 194
                    p->scanResults[i1].informationElements = NULL;
                    switch (p->scanResults[i1].p2pDeviceRole)
                    {
                        case CSR_WIFI_SME_P2P_ROLE_GO:
                        {
195
                            u16 i4;
196 197
                            for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
                            {
198
                                kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
199 200 201
                                p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
                            }
                        }
202
                            kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo);
203 204 205
                            p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL;
                            break;
                        case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
206
                            kfree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType);
207 208 209 210 211 212 213
                            p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL;
                            break;
                        default:
                            break;
                    }
                }
            }
214
            kfree(p->scanResults);
215 216 217 218 219 220
            p->scanResults = NULL;
            break;
        }
        case CSR_WIFI_SME_TSPEC_IND:
        {
            CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message;
221
            kfree(p->tspec);
222 223 224 225 226 227
            p->tspec = NULL;
            break;
        }
        case CSR_WIFI_SME_TSPEC_CFM:
        {
            CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message;
228
            kfree(p->tspec);
229 230 231 232 233 234
            p->tspec = NULL;
            break;
        }
        case CSR_WIFI_SME_VERSIONS_GET_CFM:
        {
            CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message;
235
            kfree(p->versions.routerBuild);
236
            p->versions.routerBuild = NULL;
237
            kfree(p->versions.smeBuild);
238 239 240 241 242 243
            p->versions.smeBuild = NULL;
            break;
        }
        case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM:
        {
            CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message;
244
            kfree(p->cloakedSsids.cloakedSsids);
245 246 247 248 249 250
            p->cloakedSsids.cloakedSsids = NULL;
            break;
        }
        case CSR_WIFI_SME_ERROR_IND:
        {
            CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message;
251
            kfree(p->errorMessage);
252 253 254 255 256 257
            p->errorMessage = NULL;
            break;
        }
        case CSR_WIFI_SME_INFO_IND:
        {
            CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message;
258
            kfree(p->infoMessage);
259 260 261 262 263 264
            p->infoMessage = NULL;
            break;
        }
        case CSR_WIFI_SME_CORE_DUMP_IND:
        {
            CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message;
265
            kfree(p->data);
266 267 268 269 270 271 272 273 274 275
            p->data = NULL;
            break;
        }

        default:
            break;
    }
}