Merge branch 'fixes-togreg' into togreg
[firefly-linux-kernel-4.4.55.git] / drivers / staging / csr / csr_wifi_nme_ap_free_downstream_contents.c
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2012
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
13 #include "csr_pmem.h"
14 #include "csr_wifi_nme_ap_prim.h"
15 #include "csr_wifi_nme_ap_lib.h"
16
17 /*----------------------------------------------------------------------------*
18  *  NAME
19  *      CsrWifiNmeApFreeDownstreamMessageContents
20  *
21  *  DESCRIPTION
22  *
23  *
24  *  PARAMETERS
25  *      eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled
26  *      message:    the message to free
27  *----------------------------------------------------------------------------*/
28 void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message)
29 {
30     if (eventClass != CSR_WIFI_NME_AP_PRIM)
31     {
32         return;
33     }
34     if (NULL == message)
35     {
36         return;
37     }
38
39     switch (*((CsrWifiNmeApPrim *) message))
40     {
41         case CSR_WIFI_NME_AP_CONFIG_SET_REQ:
42         {
43             CsrWifiNmeApConfigSetReq *p = (CsrWifiNmeApConfigSetReq *)message;
44             CsrPmemFree(p->apMacConfig.macAddressList);
45             p->apMacConfig.macAddressList = NULL;
46             break;
47         }
48         case CSR_WIFI_NME_AP_START_REQ:
49         {
50             CsrWifiNmeApStartReq *p = (CsrWifiNmeApStartReq *)message;
51             switch (p->apCredentials.authType)
52             {
53                 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
54                     switch (p->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
55                     {
56                         case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
57                             CsrPmemFree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase);
58                             p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase = NULL;
59                             break;
60                         default:
61                             break;
62                     }
63                     break;
64                 default:
65                     break;
66             }
67             {
68                 CsrUint16 i3;
69                 for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
70                 {
71                     CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel);
72                     p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL;
73                 }
74             }
75             CsrPmemFree(p->p2pGoParam.operatingChanList.channelEntryList);
76             p->p2pGoParam.operatingChanList.channelEntryList = NULL;
77             break;
78         }
79
80         default:
81             break;
82     }
83 }
84
85